Re: Referring to package variables in the default namespace in p6

2005-07-21 Thread TSa (Thomas Sandlaß)
Matthew Hodgson wrote: These rules are all fair enough - but they are then ambiguous for $::Foo. Is that the leaf name variable Foo in your current (innermost) namespace? It is not ambiguous if the sigil rules that expression. I assume that the parameters of a sub are definining innermost

Re: Referring to package variables in the default namespace in p6

2005-07-21 Thread Matthew Hodgson
On Thu, 21 Jul 2005, TSa (Thomas Sandlaß) wrote: Matthew Hodgson wrote: I guess $::('Foo') was a bad example - $Foo=Foo; $::($Foo) would have been better at illustrating my point - which was that if $::($Foo) searches outwards through namespace for a variable whose name is held in $Foo, then

Re: Referring to package variables in the default namespace in p6

2005-07-21 Thread TSa (Thomas Sandlaß)
HaloO Matthew, you wrote: I wasn't getting hung up on whether $::($varname) should somehow be cached to avoid a dynamic lookup based on the current value of $varname every time. And I assume that if $*Main::foo hadn't been created, assigning to $::($varname) would create it as expected

Re: Referring to package variables in the default namespace in p6

2005-07-21 Thread Dave Whipp
TSa (Thomas Sandlaß) wrote: Here your expectations might be disappointed, sorry. The non-symbolic form $*Main::foo = 'bar' creates code that makes sure that the lhs results in a proper scalar container. The symbolic form might not be so nice and return undef! Then undef = 'bar' of course let's

Re: Referring to package variables in the default namespace in p6

2005-07-20 Thread Matthew Hodgson
On Wed, 20 Jul 2005, TSa (Thomas Sandlaß) wrote: Matthew Hodgson wrote: I'm very surprised that package variables end up in OUR::, however - because surely they're not necessarily lexically scoped - and the whole point of 'our' was lexical global scoping, right? :/ Sorry, what is 'lexical

Re: Referring to package variables in the default namespace in p6

2005-07-19 Thread Larry Wall
On Tue, Jul 19, 2005 at 07:25:35PM +0100, Matthew Hodgson wrote: : Hi all, : : I've spent some of the afternoon wading through A12 and S10 trying to : thoroughly understand scope in perl 6, in light of the death of use vars : and the addition of class (as well as package module) namespaces. :

Re: Referring to package variables in the default namespace in p6

2005-07-19 Thread Matthew Hodgson
On Tue, 19 Jul 2005, Larry Wall wrote: On Tue, Jul 19, 2005 at 07:25:35PM +0100, Matthew Hodgson wrote: : : So the question is: what is the correct syntax for referring to package : variables in the default namespace? The * looks like a twigil but it isn't really. It's short for *::, where