I've got a partial solution to the pending question of namespace vs. class.
Specifically, I've realized that Parrot already had most of a simple
solution to populating a class's methods even if the class has no public
namespace, what with the ".const .Sub" technique.

When I went to implement the rest, I found it was already mostly there:
default.pmc already implements the "add_method" vtable entry, but there's no
"addmethod" opcode...  or at least, there _was_ no "addmethod" opcode until
a minute ago.  :-)  This example now works:

        .sub main :main
            .local pmc c
            c = newclass ['whatever']

            .const .Sub foo = "whatever_foo"
            addmethod c, "foo", foo

            $P0 = new ['whatever']
            $P0.foo()   
        .end

        .sub whatever_foo :anon :method
            print "Foo!\n"
        .end

Note that the default implementation of vtable add_method() still depends on
public namespaces.  But we can fix that.  }:-)
-- 
Chip Salzenberg <[EMAIL PROTECTED]>

Reply via email to