Piers Cawley wrote:
I would like to be able to iterate over all the objects in the live set.
My Idea actually is to embedd that into the namespace syntax. The idea is that of looking up non-negativ integer literals with 0 beeing the namespace owner. for ::Namespace -> $instance { if +$instance != 0 { reconfigure $instance } } Hmm, how would that be written inside the owning class? for :: -> $instance {...} # or perhaps ::_ or ::0 Hmmmm, and the current actor/owner is $/ which gives the expanded method call syntax: .method # really means: $/.method($_) Then we need to distinguish between the owner of a block and the topic of the block. In methods the owner is called invocant, of course. This also nicely unifies rules and methods. But with the drawback that the brawl then shifts from topic versus invocant to rules and method competing for ownership :)
ISTM that exposing the Garbage Collector at the Language level is the neatest way of doing this (or coming up with something like Ruby's ObjectSpace, but conceptually I reckon the GC is the right place to hang it).
To me the GC is an implementation detail for rendering the illussion of infinite memory :) For example +::Int could return the number of instances in use not the potential Inf many ones. Adding the infix namespace wildcard could allow to retrieve attributes as arrays indexed by object id: @instvalues = ::SomeClass::*::attr; The access control on a level behooves its owner/origin that is ::NameSpace::0. This gives in the end a virtual tree of all static information. As a fallout, structured rule matches can also be queried with :: and as such nicely blend strings into the type system. E.g. after successfull recognition an object could be "created" by simply reparenting it from the rule to its class/owner. The referential fabric and the call chains are hang-off this structure somehow, as well. Everything else is basically garbage. Too far off the mark? If not, I've ideas for ?? and :: beeing top precedence namespace query ops. Only effect is that the current meaning needs parens like ($condition ?? $value :: $other) for preventing strange tokenization. OTOH would the barebone structure of Perl6 revolve around ?? :: ::= () ; and namespace lookup. -- TSa (Thomas Sandlaß)