> [EMAIL PROTECTED] (Nathan Wiger) wrote on 14.08.00 in
> <[EMAIL PROTECTED]>:
>
>> Well, lexical variables don't belong to any package in Perl. They're not
>> in the symbol table, hence why others can't mess with them. That's why a
>> "my $var" is different from a "$pkg::var". The latter gets i
>> Furthermore, in the "more rope" department, it might be possible to make
>> local() work on my() variables this way.
>
> I'm still unsure if this is a good thing. I think it is, but it's worth
> some pondering.
>
> -Nate
>
In the programming languages class I took last year, we wrote an
inte
Kai Henningsen wrote:
>
> 1. Package variables $package::var, presumably you'd have to declare those
> and the default would be
> 2. lexical variables,
Not bad, but I think #1 violates Laziness if I hear you right. Let's add
a "global" or "your" keyword to do this inside a package:
package M
[EMAIL PROTECTED] (Nathan Wiger) wrote on 14.08.00 in <[EMAIL PROTECTED]>:
> Well, lexical variables don't belong to any package in Perl. They're not
> in the symbol table, hence why others can't mess with them. That's why a
> "my $var" is different from a "$pkg::var". The latter gets in the sym
>> I'll be submitting the RFC to the librarian as usual, but sending it
>> to this list as well to allow for immediate follow-up. Our deadline
>> is fast approaching.
>>
>> Rushed,
>> J. David
>
> Naw, I wouldn't worry about this. Email Kirrily and ask for an
> extension. That's what I did for
> I'll be submitting the RFC to the librarian as usual, but sending it
> to this list as well to allow for immediate follow-up. Our deadline
> is fast approaching.
>
> Rushed,
> J. David
Naw, I wouldn't worry about this. Email Kirrily and ask for an
extension. That's what I did for -io. Let's
>> *) Lexical variables belong to the package they are declared in. (Or,
>> if not declared, the package to which they belong can be inferred.)
>
> Well, lexical variables don't belong to any package in Perl. They're not
> in the symbol table, hence why others can't mess with them. That's why a
>
> how is "your" different from "our"?
>
> use MyPackage;
> our $DEBUG=1;
There's a very subtle difference in the way symbol tables are
maintained. our() doesn't actually put the variable in the symbol table
directly. The basic difference between your() and our() would be:
our() = package wi
Nathan Wiger wrote:
>
> However, make lexicals the default so that MyPackage would have to look
> like this:
>
>package MyPackage;
>
># my is redundant since lexicals are default
>my($internal1, $internal2) = ('value1', 'value2');
>
># have to use your to give this variable to oth
> *) Lexical variables belong to the package they are declared in. (Or,
> if not declared, the package to which they belong can be inferred.)
Well, lexical variables don't belong to any package in Perl. They're not
in the symbol table, hence why others can't mess with them. That's why a
"my $var
Here's a radical thought:
In most languages, dynamic scoping of variables offers no advantages
over lexical scoping, other than dynamic assignment. Dynamic
assignment can be accomplished with the local() operator (soon to be
renamed, I hope). The local() operator can be extended to operate
11 matches
Mail list logo