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

Re: fixing smartmatch just hard enough (and when, too)

Thread Previous | Thread Next
From:
Jesse Luehrs
Date:
August 20, 2012 05:45
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
20120820124529.GK11137@tozt.net
On Thu, Aug 16, 2012 at 05:58:16PM -0400, Ricardo Signes wrote:
> Also, `when` should be valid inside an auto-topicalizing `while`, providing an
> implicit next, making its behavior more generic so that `when` can be used
> safely everywhere that it makes sense.

One other thing - why do we limit the use of 'when' like this at all? Is
there any reason we can't just say that when always does an implicit
next regardless of where it's used, and so any time you're in a context
where 'next' makes sense (which is really most places), 'when' would
also work? For instance:

  $_ = "foo";
  {
      when (/f/) { ... }
      when (/a/) { ... }
  }

Is there any reason that something like that wouldn't have well-defined
semantics?

-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