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.

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.

> On a related note, are we supposed to name our namespaces [ "Foo", "Bar" ]
> or [ "Foo::Bar" ] nowadays?

Nested namspaces BTW: [ "Foo"; "Bar" ] aren't yet supported. Missing is
also the namespace name mangling (appending a NUL). The colon separated
thing is just one namespace - no nesting at all.

> ... 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?

I think to create a nested class, we need something like:

    set_namespace ["Foo"]
    subclass cl, "Foo", "Bar"
    ...

  .namespace ["Foo" ; "Bar" ]

     methods

> Luke

leo

Reply via email to