| perl6 with takes a context |
with takes a context
Maintainer: David Nicol <perl6rfc@davidnicol.com> Date: 28 Sep 2000 Mailing List: perl6-language@perl.org Number: 340 Version: 1 Status: Developing
"call frames" become useful as objects. The current one is always with with no argument and you can get into an arbitrary one by using with $whatever BLOCK in either forward or backward form, like if.
sub A{
my $A = shift;
return with;
};
$context1 = A(3);
print "$context1"; # something like CONTEXT(0XF0GD0G)
print "$A" with $context1; # prints 3
with $context1{print "$A"}; # same thing
The context-access with takes a scalar argument, the pascal-like with takes a hash. If the pascal-like with is considered as describing aliases to defined variables, the two have deep similarities.
In an array context, one of these CONTEXT things will expand into key-value pairs if it can.
using with to store contexts may adversely affect memory recycling.
Perl5 has the hooks required to do this: the closure stuff. This proposed with keyword makes access into such things more explicit.
None.
|
Perl.org sites
: bugs
| dev
| history
| jobs
| learn
| lists
| use
Site Information and Contacts |
|