Re: Packages, Modules and Classes

2005-09-09 Thread Larry Wall
On Thu, Sep 08, 2005 at 07:41:52PM -0400, Stevan Little wrote: : So it would be Foo::.keys() then? : : Would this be possible? The more I think about it, the more I'm leaning toword postfix operators ::{} and ::, essentially in same syntactic niche as ::(). Which means you'd have to write that

Re: Packages, Modules and Classes

2005-09-09 Thread Larry Wall
On Fri, Sep 09, 2005 at 08:46:06AM -0700, Larry Wall wrote: : If these are really postfix operators, then we can also write : : Foo .::{} : Foo .:: : Foo .::() But I don't think they can really be postfix. At least, ::() isn't, since $Foo .::($bar) would not be the same as we

Re: Packages, Modules and Classes

2005-09-08 Thread Larry Wall
On Wed, Sep 07, 2005 at 03:00:29PM -0400, Stevan Little wrote: : If methods and subs are in the same namespace, and both have the : sigil, what about instance attributes and class attributes? Is this : legal? : : class Foo { : my $.bar; : has $.bar; : } : : Part of me thinks that

Re: Packages, Modules and Classes

2005-09-08 Thread Stevan Little
Larry, On Sep 8, 2005, at 2:30 PM, Larry Wall wrote: On Wed, Sep 07, 2005 at 03:00:29PM -0400, Stevan Little wrote: : Also, is there anyway to iterate over the keys in the namespace? The : old way would be to do something like keys(%Foo::). Is something like : this possible with the new way?

Re: Packages, Modules and Classes

2005-09-08 Thread Larry Wall
On Thu, Sep 08, 2005 at 04:52:52PM -0400, Stevan Little wrote: : But what if I want to do this? : : class Foo { : my %:stuff; : method keys (Class $c:) { : %:stuff.keys(); : } : } : : How can I get at my namespace now? How would I disambiguiate that call? : Doing

Re: Packages, Modules and Classes

2005-09-08 Thread Stevan Little
Larry, On Sep 8, 2005, at 5:07 PM, Larry Wall wrote: On Thu, Sep 08, 2005 at 04:52:52PM -0400, Stevan Little wrote: : But what if I want to do this? : : class Foo { : my %:stuff; : method keys (Class $c:) { : %:stuff.keys(); : } : } : : How can I get at my

Re: Packages, Modules and Classes

2005-09-07 Thread Larry Wall
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 :

Re: Packages, Modules and Classes

2005-09-07 Thread Larry Wall
On Wed, Sep 07, 2005 at 08:46:24AM -0700, Larry Wall wrote: : No special {FOO} subscripts, so the question doesn't arise. To the : symbol table all blocks are stored as Foobar, presumably with : extra canonicalized key info for long names. Actually, we might well omit the '' on Code objects for

Re: Packages, Modules and Classes

2005-09-07 Thread Stevan Little
Larry, On Sep 7, 2005, at 11:46 AM, Larry Wall wrote: : 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

Re: Packages, Modules and Classes

2005-09-07 Thread Larry Wall
On Wed, Sep 07, 2005 at 12:27:20PM -0400, Stevan Little wrote: : How do I differentiate a method from a sub? Wouldn't they both have the : sigil? Yes, as it currently stands, you can only tell that by introspection. : : class Foo; : : has $.baz; : : method bar { ... } : : : : Can I get

Re: Packages, Modules and Classes

2005-09-07 Thread Stevan Little
Larry, On Sep 7, 2005, at 12:45 PM, Larry Wall wrote: : All sigils and twigils are part of the key to the symbol table, so it's : now just : : Foo$.baz : : What would Foo$.baz return though (assuming Foo is a class)? It : cannot return a value since it is an instance specific value.

Packages, Modules and Classes

2005-09-06 Thread Stevan Little
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