in reply to Re^5: Declaring with my, assigning, and testing in same line (attributes)
in thread Declaring with my, assigning, and testing in same line
I had the model for CODE attributes in mind which happen at compile time:
(excerpt from attributes )
3. Code: package X; sub foo : lvalue ; Effect: use attributes X => \&foo, "lvalue";
That's why Attribute::Handlers is putting such emphasis onto the compilation phase when the association happens.
but LEXICAL attributes seem to call import with each declaration at run-time (which is consistent with the fact that my has a compile and a run-time effect.)
2. Code: package Felis; my $cat : Nervous; Effect: use attributes (); attributes::->import(Felis => \$cat, "Nervous");
maybe Attribute::Handlers should be clearer about this?
> There are ways how not to be wrong.
(A disturbance in the Force happens)
Now more potential in using attributes I see ... ;-) ¹
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
update
¹) to be more specific ... this behaviour means that the untie happens almost immediately after the tie, i.e. the potential for possible ugly side effects is practically zero.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Declaring with my, assigning, and testing in same line (attributes)
by choroba (Cardinal) on Dec 15, 2015 at 09:44 UTC | |
by LanX (Saint) on Dec 15, 2015 at 10:23 UTC |