develooper Front page | perl.perl5.porters | Postings from September 2012

Re: given/when/~~ "final" thoughts (ha ha ha)

Thread Previous | Thread Next
From:
Jesse Luehrs
Date:
September 26, 2012 15:32
Subject:
Re: given/when/~~ "final" thoughts (ha ha ha)
Message ID:
20120926223223.GA11137@tozt.net
On Thu, Sep 27, 2012 at 12:29:26AM +0200, Aristotle Pagaltzis wrote:
> * Father Chrysostomos <sprout@cpan.org> [2012-09-17 02:15]:
> > Making it work wouldn’t be hard. That would also make lexicals
> > visible, as in when{my $x}{$x}. I can’t say I’m very fond of the idea.
> > But I am not opposed to it per se.
> 
> I think it has to work, actually:
> 
>     if   ( my $x = foo $bar ) { do_something_with $x }
>     when { my $x = foo $bar } { do_something_with $x }

The trouble is that the initial concept for "when { ... }" was that it
was simply syntactic sugar for "when(sub { ... })". Moving away from
that may end up making things more complicated, conceptually.

-doy

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