On Sep 29, 2004, at 7:25 AM, Dan Sugalski wrote:

Okay, after seeing all the back and forth, here's what we're going to do.

Namespaces are going to be *simple*. They do two things, and only two things.

1) They provide a hierarchy for other namespaces
2) They bind names to PMCs

That's it. No typing, no classification, no nothing.

By postpending a null character, below, you _are_ doing typing/classification, of course. And, what about subs?


If languages want to do that, then they'd better darned well do it themselves. Yes, this is going to make interoperability a pain at the variable level, but it's pretty clear that we're just not going to be able to do that.

The next step, then, is to sketch out ops to query, read, and write name/PMC bindings and query/read/write/overlay hierarchies. (Which, I realize, many languages just won't use, and that's fine) I think it's best to go with a unified hierarchy/variable namespace, so we'll postpend a NUL to the end of non-variables. Printing NULs is a pain, so we should make sure that we've got good general-purpose binary printing routines people can use.

As Larry said, it's best to prepend it. And then we can call it a sigil. And since we're name mangling, pick a printable character like ":" for the prefix, since we'll know the initial character is always really a throw-away encoding of the syntactic category. Then we're back to _exactly_ my scheme, with the syntactic category names as single characters, and as an implementation detail shoving the category and name together in a single string instead of keeping them separate. And of course this will all be awkward for languages with distinct syntactic categories, but without natural name mangling. And it will probably result in more intermediate strings being allocated.


This is exactly like open(IN, "<file") v. open(IN, "<", "file"), and we're deciding that the former is vastly superior.

And of course, you do realize that in Perl5, this:

        $data[1]

refers to the variable @data, so that even for Perl5 there will be name-mangling (not just the ability to use the literal sigil-plus-namae as seen in the source).

Yes, I know, we could do better. If anyone wants to do so, go lock Larry, Matz, and Guido in a room together. When they hash out the language semantics we'll let 'em out and then do better. :)

We don't need Larry, Matz, and Guido to agree on anything here. I explained a scheme which would work for all of their languages, as well as Scheme, Common Lisp, Objective-C, Java, C, and probably anything else. It just requires acknowledging that different languages have different sets of syntactic categories, rather than pretending things are simpler than they are.


JEff



Reply via email to