That results with "Not enough arguments for vec()." And, illustrates in brilliant colors the stupidity of compile-time checking in a dynamic language.
I see what you mean. And boy, do I ever agree with you regarding attempts to force static language semantics upon dynamic languages.
Playing with this, my first thought was to disable the prototype checking:
&vec( $thing, @params ) = 1;
but that resulted in: Can't modify non-lvalue subroutine call which came as a complete surprise.
I never knew that the l-valueness of a subroutine was allied to its prototype. The best alternative I came up with is:
sub myvec :lvalue { CORE::vec( $_[ 0 ], $_[ 1 ], $_[ 2 ] ) }
which once you get past the deliberate error ;) in the example:
my $thing = 'a' x 10;
my @params = ( 2, 3 );
myvec( $thing, @p ) = 1;;
Illegal number of bits in vec
seems to work fine. Of course, you pay a performance penalty for the indirection, but hey. CPU cycles don't matter :)
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|