Jonathan Scott Duff wrote:
On Wed, Sep 13, 2006 at 10:20:31AM +1200, Sam Vilain wrote:
Larry Wall wrote:

.META is more correct at the moment.
Does making it all upper caps really help? It's still a pollution of the
method space, any way that you look at it...

Yeah but perl has already has a cultural claim on ALLCAPS thingys.
So, yes, it does help.

Is the goal to avoid namespace pollution? If so, shouldn't there be a truly "metaish" way of getting at the internal namespace so that someone doesn't accidentally render an object unusable by defining the wrong method name (which you can prevent with an error if the object is defined in Perl, but not if it's defined in Parrot or another language)? Imagine this code:

        class HTML4::Elements {
                method H1 {...}
                method P {...}
                method META {...}

Worse, imagine accessing it through a Ruby or Python object. How would you say, "this object has a real .META, please invoke it"? WHERE is even stickier, since its use as an SQL keyword (case insensitive) makes conflicts much more likely, and problematic.

There are dozens of ways that we could be explicit about digging into internal namespace. Some would be syntactic:

        $object\.meta (or \.how)
        $object.*meta (or .*how)

Some would involve specifying the starting-point for dispatch:

        $object.::meta (or .::how)
        $object.Object::meta (or .Object::how)

I can think of more, and, I'm sure I'm incapable of thinking of all of them. Simply spelling things strangely in order to avoid namespace collisions ignores the fact that the current need is not unique, and any solution you present should work well across objects from any language source.

It should also probably be very clear when you are talking to the object system vs. when you are talking to an object. $foo.META (or .HOW) doesn't really make that as clear as I think it should be for code clarity.

Of course, you'll probably want to have a way to re-define the object system itself, so you need to be able to say something like:

        class X { method *meta($self:) { $self.MyOO::meta }


        class X { method meta() is internal {...} }

IMHO, the golden rule of programming languages should be: if you need a namespace, create one.

Reply via email to