Newsgroups: perl.perl6.language
From: ibl...@web.de (Ingo Blechschmidt)
Date: Sat, 20 Aug 2005 22:33:03 +0000 (UTC)
Local: Sat, Aug 20 2005 6:33 pm
Subject: Symbolic dereferentiation of magical variables
Hi,
S02 says: my $a; say $::("a"); # dies, you should use: How can I use symbolic dereferentiation to get $?SELF, $?CLASS, say $::('$?SELF'); # does this work? Also, is $::! valid syntax? (Or am I required to write this as --Ingo -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Sun, 21 Aug 2005 07:23:34 -0700
Local: Sun, Aug 21 2005 10:23 am
Subject: Re: Symbolic dereferentiation of magical variables
On Sat, Aug 20, 2005 at 10:33:03PM +0000, Ingo Blechschmidt wrote: : Hi, : : S02 says: : our $a; say $::("a"); # works : : my $a; say $::("a"); # dies, you should use: : my $a; say $::("MY::a"); # works That looks like somebody's relic of Perl 5 thinking. Personally, : How can I use symbolic dereferentiation to get $?SELF, $?CLASS, Probably not, since the ::() notation doesn't want sigils in the key, $?::('SELF') to have any hope of it working. On the other hand %MY::<$?SELF> might get you the symbol out of the symbol table hash, unless $?SELF : say $::('MY::$?SELF'); # or this? No, we don't currently allow sigils after ::. But maybe we could have say $::('MY::<$?SELF>'); # or this? : Also, is $::! valid syntax? (Or am I required to write this as I suspect :: after a sigil is always a no-op unless it's followed by $OUTER::OUTER::<$_> and such.) I think I like the option lowering the sigil to the key. OUTER::OUTER::<$_> But if we say that any package/type name can tagmemically function OUTER::OUTER<$_> Though we're getting close to confusing this notation with %OUTER::OUTER::{'$_'} which looks similar, but (if we take the Perl 5 meaning) doesn't OUTER{'$OUTER::_'} because it's accessing through the package as a hash and does further %OUTER::{'$OUTER::_'} because it's accessing through the actual symbol table hash, which doesn't That's an awfully subtle distinction, though. I think OUTER::OUTER's FOO.findsym('$x') on a class that defines its own findsym method. Or maybe that's Larry You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: perl.perl6.language
From: ibl...@web.de (Ingo Blechschmidt)
Date: Mon, 22 Aug 2005 22:51:53 +0200
Local: Mon, Aug 22 2005 4:51 pm
Subject: Re: Symbolic dereferentiation of magical variables
Hi,
Larry Wall wrote: I like that very much! :) > On Sat, Aug 20, 2005 at 10:33:03PM +0000, Ingo Blechschmidt wrote: > : S02 says: > : our $a; say $::("a"); # works > : > : my $a; say $::("a"); # dies, you should use: > : my $a; say $::("MY::a"); # works > That looks like somebody's relic of Perl 5 thinking. Personally, > : How can I use symbolic dereferentiation to get $?SELF, $?CLASS, ok. > : ::?CLASS, %MY::, etc.? > : > : say $::('$?SELF'); # does this work? > Probably not, since the ::() notation doesn't want sigils in the key, > $?::('SELF') > to have any hope of it working. On the other hand > %MY::<$?SELF> > might get you the symbol out of the symbol table hash, > unless $?SELF is too macro-y for that. $? variables aren't required Makes perfect sense. > to have a dynamically lookupable meaning at run time, since their > native dynamic context is the compiler, not the run-time. > : say $::('MY::$?SELF'); # or this? > No, we don't currently allow sigils after ::. I like those, especially as we've said that the sigils are part of the variable name. Makes sense. > Which makes me think that Perl 5's %FOO::{'name'} symbol table If we go with these changes, this functionality (starting place for a > notation is really bogus, because %OUTER:: doesn't really refer to a > single symbol table in Perl 6, but the starting place for a symbol > search that may span several symbol tables. search) would be available by using Foo::Bar<$symbol_to_lookup>; # right? --Ingo -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Mon, 22 Aug 2005 14:17:59 -0700
Local: Mon, Aug 22 2005 5:17 pm
Subject: Re: Symbolic dereferentiation of magical variables
On Mon, Aug 22, 2005 at 10:51:53PM +0200, Ingo Blechschmidt wrote: : If we go with these changes, this functionality (starting place for a : search) would be available by using : : Foo::Bar<$symbol_to_lookup>; # right? Presumably, though Foo::Bar differs from OUTER in that, for packages, Larry You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: perl.perl6.language
From: Thomas.Sandl...@orthogon.com (TSa)
Date: Wed, 21 Sep 2005 13:15:32 +0200
Local: Wed, Sep 21 2005 7:15 am
Subject: Re: Symbolic dereferentiation of magical variables
HaloO Larry,
you wrote: Just for the records: this implies an asymmetry between bareword > On Mon, Aug 22, 2005 at 10:51:53PM +0200, Ingo Blechschmidt wrote: > : If we go with these changes, this functionality (starting place for a > : search) would be available by using > : > : Foo::Bar<$symbol_to_lookup>; # right? > Presumably, though Foo::Bar differs from OUTER in that, for packages, outwards scans and infixed :: scans. The latter imply a prefixed *:: while the former don't, right? Or do you mean there's a single attempt to get Bar from the innermost Foo and only if *that* fails to fall back to *::Foo::Bar instead of scanning on outwards for candidates for Foo to query for Bar and eventually reaching the root and ultimately fail there. Or not even a single attempt? This would then behave like the UNIX <weird> In case 1) the ::Foo::Bar form is only needed to defer the > Maybe there could be some way One that comes to mind is in providing a sandboxed environment > for Foo::Bar to delegate to Foo if it likes, though. Sort of an > inside-out import. But we've got along fine without that in Perl 5, > so I'm not going to mandate it in the base language unless we see > some really good uses for it. without resorting to replicating the Perl6 root namespace environment. When you know that a boxed module needs a Foo with a certain structure you just provide that---easy enough. But if then the code you are wrapping happend to access the Bar from Foo with the oververbose syntax Foo::Bar this lookup suddenly warps out of the sandbox into the actual root environment of the interpreter... > In general we should encourage outer Isn't that mixing access control in an unfortunate way with the > classes to share with inner classes via lexical scoping rather than > package scoping, I expect. namespace manouvering syntax? OTOH, I hear me saying that privacy comes from hiding... -- $TSa.greeting := "HaloO"; # mind the echo! You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2009 Google |