At 11:48 AM +0100 11/24/04, Leopold Toetsch wrote:
Luke Palmer <[EMAIL PROTECTED]> wrote:

Should there be one for invoking a sub out of a namespace, say:

.namespace [ "Baz" ]

     .sub quux
         [ "Foo", "bar" ]()

Looks a bit strange.

I think for this being explicit is fine:

    $P1 = global ["Foo"], "bar"
    $P1()

Class methods already have their namespaces. For subs we could do:

  .locale pmc ns, ns_foo
  ns = interpinfo .CURRENT_NAMESPACE        # or .TOPLEVEL_NAMESPACE
  ns_foo = ns ["Foo"]

  ns_foo."bar"()

The namespace PMC provides the find_method() that's actually behind that
call. With the additional benefit that it's using the method cache too.

Hrm. No, I don't think this is the right way to go for this, and I don't think it ought to use the method cache. It'll certainly screw up code that does the sensible thing and looks to see if an object was passed to see if it was invoked as a method or sub.


Subs aren't methods, and shouldn't be invoked as such. They really *are* subs, and at best the invocation should be:

    ns_foo["bar"]()

except we don't do that any more.

This should be a two step thing, doing a fetch and then sub invoke.

> ... If the former, how do we name our classes?
Do we have to mangle those ourselves, or is there a way to put a class
> in a namespace?

This is turning out to be a more complex issue. Namespaces might not be the right answer here.
--
Dan


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

Reply via email to