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

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

Thread Previous | Thread Next
From:
Johan Vromans
Date:
August 27, 2012 23:21
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
m2txvncz9u.fsf@phoenix.squirrel.nl
Jesse Luehrs <doy@tozt.net> writes:

>> • when(3, 4, 5)
>
> These are exactly the kinds of arbitrary special cases that we are
> trying to eliminate.

I sympathise with Klaus here. Remember that 'when' is (sort of) case
statement, and it is quite common for multiple cases to trigger the same
action. So it's either

  when (3, 4, 5) { action() }

or

  when (3) when (4) when (5) { action() }

but let's avoid having to write

  when(3) { action() }
  when(4) { action() }
  when(5) { action() }

-- Johan

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