develooper Front page | perl.perl5.porters | Postings from October 2015

Re: YA smartmatch proposal

Thread Previous | Thread Next
From:
Lukas Mai
Date:
October 7, 2015 17:08
Subject:
Re: YA smartmatch proposal
Message ID:
56155169.7020706@gmail.com
Am 07.10.2015 um 10:24 schrieb Dave Mitchell:
>
> What I think we should do:
>
> 1. Get rid of the ~~  operator altogether, plus '~~' overloading.
>
> 2. Make when's behaviour entirely dependent on the *compile-time* class
> of of its arg. In particular, make 'when (FOO)' have exactly the following
> behaviours:
>
>      FOO             condition evaluates to
>      --------------  ----------------------
>      literal undef             !defined($_)
>      numeric const                $_ == FOO
>      literal pattern              $_ ~= FOO
>      all else                     $_ eq FOO
>
> 3. when { FOO } has condition FOO.

(You typo'd =~ as ~= above)

This would mean 'when (qr/.../)' becomes 'when { $_ eq qr/.../ }'.

-- 
Lukas Mai <plokinom@gmail.com>

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