Interesting...
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 ... ;-) ¹
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. |