At 7:32 PM -0700 9/22/04, Jeff Clites wrote:
On Sep 22, 2004, at 10:58 AM, Dan Sugalski wrote:

*) There are three things that can be in a namespace: Another namespace, a method or sub, and a variable.

*) The names of namespaces, methods & subs, and variables do *not* collide. You may have a namespace Foo, a sub Foo, and a variable Foo at the same level of a namespace.

The easiest way to say these two point may be just to say that each namespace has three sections, and a given lookup is always a lookup in a specific section.


One problem: Some languages (Scheme, for example, and arguably C) have a unified namespace for subs and variables. What to do there?

The easiest thing would be to allow the languages to store into multiple sections at once, or leave it to them to do the right thing as they need to. Either way works OK for me, since neither Scheme nor C are really our target languages.


*) Sub and method names *will* collide, so be careful there.

I'm not sure that they will.

I'd really, *really* rather they did. Not because I'm up for collisions (I'm not) but because if you *do* leave methods in namespaces it allows you to do all sorts of very interesting things with lexically overlaid namespaces.


*) If a language wants different types of variables to have the same name, it has to mangle the names. (So you can't have an Array, a String, and an Integer all named Foo) The only language I know of that does this is Perl, and we just need to include the sigil as part of the name and we're fine there.

This seems antithetical to cross-language functionality.

Why? Not to be snarky here, I'm curious.

Strictly speaking, the names can be anything, which is fine. Nulls, control characters, punctuation, grammatically incorrect Bengali insults... we don't put any limits on 'em. And the only place that it makes any difference at all is when you're either doing the equivalent of C's extern or explicitly walking the namespace. In the latter case you ought to be ready for anything (since with Unicode I fully expect to see the full range of characters in use) and in the former case, well... you ought to be ready for anything since Unicode's going to put the full range of characters into use. :)

Treating the perl sigil as part of the variable name is cute and all, but if we take that to heart at the Parrot level, then we really cut off cross-language access in any natural way.

Again, why? (Though it's somewhat academic. Besides leading to globs, and we *so* don't want to go there, Larry's declared that perl variable names include the sigil)


*) Namespaces, by default, support notifications.

What does that mean? Notification of what?

Inserts, deletes, and changes, possibly fetches too. Instrumentation. The notification system will allow code to watch for particular events happening to PMCs, and this is a good place to start. (Not to mention that the first thing anyone seems to want to do when they get down into the guts is tie namespaces)
--
Dan


--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to