Larry Wall wrote:
Or, assuming you might want to generalize to N dimensions someday, just

    sub bar ([EMAIL PROTECTED]) {...}

and deal with it as in Perl 5 as a variadic list.  I suppose one could say

    sub bar ([EMAIL PROTECTED] is shape(3)) {...}

and get checking on the argument count.

if I understand correctly, without using multi subs:

    sub bar(@coords is shape(3)) { ... }

    bar(@xyz); # ok
    bar( [$x, $y, $z] ); # ok
    bar($x, $y, $z); # compile-time error

while:

    sub bar([EMAIL PROTECTED] is shape(3)) { ... }

    bar(@xyz); # ok
    bar( [$x, $y, $z] ); # ok
    bar($x, $y, $z); # ok
    bar <== $x, $y, $z; # still ok

am I right?

cheers,
Aldo



Reply via email to