develooper Front page | perl.perl6.language | Postings from February 2005

Re: scoping functions as list operators?

Thread Previous | Thread Next
Aldo Calpini
February 25, 2005 11:04
Re: scoping functions as list operators?
Message ID:
Stéphane Payrard wrote:
> # set? I don't think so.
> my $a, $b, $c   set  1..3 ;  # alphabetic like and, or, xor? 
>                               # and what precedence relative to them?

well, I'm not sure the feature is good, but I have some idea about the 
sign that could be used for this :-)

we have all sort of verb forms in Perl6 (is, has, does) so the natural 
choice seems to be:

     my $a, $b, $c are 1..3;

perhaps it could also be made to DWIM for:

     my @colours are $red, $green, $blue;

or, more prosaically, we could coerce the fat pipe operator to work as a 
slurpy assignment in this case:

     my $a, $b, $c <== 1..3; # hmmm... am I breaking something here?

or we could even just use an hyper-equal:

     my $a, $b, $c »=« 1..3;

if not for low precedence assignment, "are" could still be used as a 
(low precedence) "plural" type declaration, as in:

     my $spot, $fido, $billy are Dog; # not Dogs, alas

but I'm afraid this wouldn't be terribly useful either.

ok, enough ranting.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About