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

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

Thread Previous
From:
Ricardo Signes
Date:
September 26, 2012 16:05
Subject:
Re: given/when/~~ "final" thoughts (ha ha ha)
Message ID:
20120926230459.GA26001@cancer.codesimply.com
* Jesse Luehrs <doy@tozt.net> [2012-09-26T18:32:23]
> 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.

My thoughts exactly.  Or, almost exactly:  I have no problem with the BLOCK
being a block and not a subroutine. ;)

The main objection to that, as I recall, was Damian's desire to have the lhs's
~~ overload take over when given a subroutine, which is no longer relevant to
the design.

-- 
rjbs

Thread Previous


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