Hey all,
I recently added Package and Module into the MetaModel (2.0) so that
Package is an Object
Module is a Package
Class is a Module
as mentioned here
http://article.gmane.org/gmane.comp.lang.perl.perl6.language/4599.
Currently Packages have names and Modules add version and authority
information, but I have nothing yet in place to represent package
symbol tables. Which brings me to my questions.
I assume that each symbol table entry has the following slots; SCALAR,
ARRAY, HASH, SUB, METH. I base this off the AUTO* hooks described in
S10. I assume too that the METH slot is only valid for Classes, and not
appropriate for Packages and Modules.
This would mean that given this code:
package Foo;
our $baz;
sub bar { ... }
%Foo::{'bar'}{SUB} is a ref to the &bar sub, and %Foo::{'baz'}{SCALAR}
is a ref to the scalar $baz. The same, I would assume, would apply for
Modules, so that:
module Foo;
our $baz;
sub bar { ... }
is pretty much interchangable with the first example. But I think it's
a little trickier when we get to Classes. Given this code:
class Foo;
our $baz;
sub bar { ... }
I would expect it to behave just as it does for a Package or Module.
But when we start to introduce methods and attributes, I am unsure of
how things will work.
class Foo;
has $.baz;
method bar { ... }
Can I get to $.baz? If I can, what will I get?
I expect that %Foo::{'bar'}{METH} will give me a method ref, but what
happens when I try to store something in it? Does that perform some
kind of meta-model actions (Foo.meta.change_method(...) or somesuch)?
What if I delete the symbol table entry, what happens then (more
meta-trickery)?
Thanks,
Stevan
Thread Next