develooper Front page | perl.perl5.porters | Postings from April 2009

Re: feature 'switch' as an expression?

Thread Previous | Thread Next
From:
Abigail
Date:
April 29, 2009 13:48
Subject:
Re: feature 'switch' as an expression?
Message ID:
20090429204903.GC30389@almanda
On Wed, Apr 29, 2009 at 04:33:44PM -0400, Mark Mielke wrote:
> Hakim Cassimally wrote:
>> I wanted to be able to write:
>>
>>     my $x = given ($blah) {
>>         ....
>>         default { 'foo' }
>>        }
>>
>> ...
>> Is there a way to work around this limitation?
>> And would it be worthwhile me submitting a docpatch to perlsyn?
>>   
>
> Seems like along that path would lie:
>
>    my $x = if ($blah) { ... } else { 'foo' };

And a bit further along:

    if ($foo) {$x} else {$y} = if ($bar) {'lala'} else {'lurf'};

> Some part of me finds your expectation appealing and some part of me is  
> revolted. :-)

I think one of more of the ALGOL variants allowed my line above
(translated to ALGOL of course).



Abigail

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