develooper Front page | perl.perl6.language | Postings from May 2001

Re: Apoc2 - Context and variables

Thread Previous | Thread Next
From:
Edward Peschko
Date:
May 4, 2001 21:29
Subject:
Re: Apoc2 - Context and variables
Message ID:
20010504212937.A14833@excitehome.net
> Maybe we need a new flattening operator. I don't think the proposed := by
> itself would do everything we need to do. Maybe we need a way to say
> "flatten these together". I'm going to throw out a new ":" op here:
> 
>    %a = (%b, %c);         # same as %a = %b
>    %a = (%b : %c);        # flattened like Perl 5
>    (%a, %b) = (%c, %d);   # kept separate
>    (%a, %b) = (%c : %d);  # %a slurps all of flattened %c and %d,
>                           # %b gets nothin'
> 
> This allows you added functionality to flatten stuff as you see fit:
> 
>    (%a, %b) = (%c : %d, @e : @f);
>    (@a, @b) = ($c : $d : $e : $f, @g : $f);
> 
> Hmmm... I kinda like that... Am I missing anything?

Of course, we could use the concatenation operator for this instead:

(%a, %b) = (%c ~ %d, $d ~ $e); 

although to make an admittedly paintshed argument, ~ is placed in such a horrid
position on the keyboard that it is really awkward to type...

Ed

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About