Front page | perl.perl6.language |
Postings from September 2001
Re: What's up with %MY?
Thread Previous
|
Thread Next
From:
Dave Mitchell
Date:
September 4, 2001 09:50
Subject:
Re: What's up with %MY?
Message ID:
200109041650.RAA09201@gizmo.fdgroup.co.uk
If there is to be a %MY, how does its semantics pan out?
for example, what (if anything) do the following do:
sub Foo::import {
my %m = caller(1).{MY}; # or whatever
%m{'$x'} = 1;
}
sub Bar::import {
my %m = caller(1).{MY}; # or whatever
delete %m{'$x'};
}
sub f {
my $x = 9;
use Foo; # does $x become 1, or $x redefined, or runtime error, or ... ?
{
# is this the same as 'my $x = 1' at this point,
# or is the outer $x modified?
use Foo;
...
}
use Bar; # is $x now still in scope?
print $x; #compile error? or runtime error? or prints 9 (or 1...) ????
Bar::import(); # any difference calling it at run time?
}
and so on....
IE what effects to do the standard hash ops of adding, modifying,
deleting, testing for existence, testing for undefness, etc etc map onto
when applied to some sub's %MY, at either compile or run time.
????
I'd be a lot happier about this concept if I knew how it was supposed
to behave!
Dave M.
Thread Previous
|
Thread Next