[Prev][Next][Index][Thread]
Re: Dylan Object Protection
Bruce Hoult wrote:
> Dylan does not have anything like private/public/protected at the class
> level. Protection in Dylan is done by exporting or not exporting things
> from the module.
>
> When you export a class from a module it does *not* automatically export
> method and field names (to be precise using Dylan terminology: it does
Err, I think there is a important point to reinforce for C++ newbies.
The "names" of the slot methods do NOT "belong" to the class namespace.
For instance, if you import a generic function with the same
name as one of your class's slot methods... you have effectively
just "exported" those methods.
The workaround for that would be to rename these previously defined
names to be to something else on import ( or rename the slot methods)
so they do not share the same generic function.
But yes, various namespace (i.e., private/protected/public ) policies
can be implemented by using modules and library export/import. Namespace
management doesn't have anything to do with the class hierarchy in Dylan.
[ a "protected" policy could also be done by grouping by a library and
not exporting module(s) that specify the intralibrary "names". ]
Lyman
References: