Squeak and Namespaces
goran at krampe.se
Thu Nov 30 08:45:56 UTC 2006
>>If we then in a while decide my solution sucks... eh, I guess the only
>>valid reason I can come up with would be that people think that
>>'Monticello::Dictionary' actually looks bad compared to 'MCDictionary',
>>then sure, revert those 3 methods it is all about and remove the '::'
>>so that it is now called 'MonticelloDictionary' - or hey, just replace
>>'Monticello::' with 'MC' and tada - we are back where we are now.
>>Renaming classes is not hard, we do it all the time. And if we ever want
>>to move away from prefixes to anything else - whatever solution you
>>think that we *ever* will be able to agree on ;) - then we would need to
>>do the same anyway.
> But this is my point. I think many people would use your solution because
> it *is* more natural to be able to just say Dictionary or SystemEditor or
> whatever within your package. So lets say that someone starts doing a lot
> of research on this in 2 or 3 years and come up with a solution 2 or 3
> after that. At that point I don't think renaming all the classes that
> be using this will be trivial.
Let me just remind you that we *already* have that problem regardless if
my solution gets in or not - in fact - we are even *worse* off. How come?
Because we *already* use "prefixes" but unfortunately in a way that
disables automated renaming. Just look: SMSqueakMap, WAComponent
> I think it will be a lot of work and thus
> not doable for the base image. I would just see it as a shame to not be
> able to adopt a new solution because of legacy.
> What you said in your other message about it not coming up unless there is
> conflict was good. That would make it easier to simply load other
> and not worry about conflicts, and then later fix them.
Yes, and let me here note that in my solution ALL references to globals
are JUST LIKE TODAY. That means that they are ALWAYS fully qualified in
the SOURCE. Sorry for the caps, but this is VERY important to realize.
It means that I can load 34 other packages into my image and as long as we
don't have *namespace name* clashes (like two people using the same name
for their namespace) nothing funky will happen in my source. All
references are still perfectly correct.
The only diff is that when I *browse* the code that earlier said
"Dictionary" now may say "Kernel::Dictionary" because my image now also
contains "Joes::Dictionar" and "Schmoes::Dictionary".
> But I just don't
> see it working like that. I think once namespaces are in they will be
> whole-sale, and the reason I think that is what you said before: we are
> using them now manually.
Yes, again, see above - problem *already* exists.
> I hope I don't sound too negative.
No problem, I just urge you to test it or read how it works. :)
> I think you have done great work and
> is good to be able to load namespaces if you need them at your company.
I don't think addon namespace solutions will ever be used. I wouldn't.
> a company, a quick stop gap is very needed because you have to deliver a
> product in a specific time frame. But squeak isn't under such
> so I don't personally see a rush to put something in the image for this.
Hehe, rush? Are you aware of when I wrote this? Are you aware of how many
posts I have written about it? Are you aware of how awfully many times the
question of Namespaces have come up on the list? It is one of the "deadly
subjects" always causing an explosion of subjective views and always end
> To be clear, I think your solution is great. I just disagree with making
> default in the image.
>> > p.s. Does it get the namespace from the category? If not, then that
>> > be something to think about. :)
>>The class creation template borrows the category name in some fashion
>>IIRC. But it is only a suggestion.
> Well I don't know. It sounds like you avoid a lot of the ambiguity by
> simply forcing every class to be explicit if there is more then one with
> same name.
Note that I thought you meant in what namespace a class is *created*.
> My thinking with categories was: if there is a conflict then the package
> could automatically resolve to the category it is in, and all classes in
> that category resolve the conflict to mean the class in their same
This mechanism of "local" references is in my solution. So yes, if a
method in Foo::Bar refers to Foo::Boo it will be enough typing "Boo" and
it will render as "Boo" even though you have 100 other Boos in your image.
But it will be "Foo::Boo" in the actual source - as always. Because that
is the name of the class.
Note that these "policy" is nicely encapsulated in a single class - just
check the code. We can play with different rules for this - but I agree -
"local references" is a special case in which we can "guess" for the user.
If he really wants "Blooper::Boo" then he will just have to type that.
> The problem with that is that there has to be a way for those classes to
> explicitly reference classes in other packages, and anything not in that
> package must always explicitly reference which class they mean. There is
> also the problem that some implicit magic happens with conflict
> So this idea would also introduce new syntax (and thus I wouldn't go for
Not sure what you mean.
More information about the Squeak-dev