On Tue, Sep 06, 2005 at 02:04:00PM -0400, Stevan Little wrote: : I assume that each symbol table entry has the following slots; SCALAR, : ARRAY, HASH, SUB, METH.
Nope, typeglobs are dead, dead, dead, dead, and dead, not necessariy in that order. : 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. All those entries are based on the notion of intuiting from the first character of the variable name within the symbol table, not from having separate typeglobbish slots within each symbol. : 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. That syntax is also dead, including the %Foo:: part of it. If you'll look at the most recent S2 from http://svn.perl.org/perl6/doc/trunk/design/syn/S02.pod (the dev.perl.org web pages are out of date), you'll find: To do direct lookup in a package's symbol table without scanning, treat the package name as a hash: Foo::Bar{'&baz'} # same as &Foo::Bar::baz GLOBAL<$IN> # Same as $*IN Foo<::Bar><::Baz> # same as Foo::Bar::Baz Unlike C<::()> symbolic references, this does not parse the argument for C<::>, nor does it initiate a namespace scan from that initial point. : 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? All sigils and twigils are part of the key to the symbol table, so it's now just Foo<$.baz> : 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)? No special {FOO} subscripts, so the question doesn't arise. To the symbol table all blocks are stored as Foo<&bar>, presumably with extra canonicalized key info for "long" names. Larry