develooper Front page | perl.perl5.porters | Postings from December 2017

Re: Revisiting smart match

Thread Previous | Thread Next
From:
Dan Book
Date:
December 19, 2017 03:38
Subject:
Re: Revisiting smart match
Message ID:
CABMkAVX=ucXsGsyGUAk3nfBEVRzWkknvxaNEAk+FTv25rNkXkg@mail.gmail.com
On Mon, Dec 18, 2017 at 10:07 PM, Karen Etheridge <perl@froods.org> wrote:

> I'm sure I missed some critical earlier part of the conversation that
> would make my questions horribly ignorant -- but I've read the perldelta
> updates about smartmatch changes and the new whereis and whereso keywords
> and I have two questions:
>
> - why is there a need for two words? surely ` somekeyword ($x ~~ $y)` and
> `somekeyword ($z)` can be implemented using the same token?
> - why is this word simply not 'where'? Smartmatch is already experiencing
> breaking changes in this release (where ~~ *has* to be implemented as an
> overload sub now on the RHS), so why can't 'when' simply be repurposed here?
>
>
The intent is that the two keywords will disambiguate `when`s currently
ambiguous behavior; it can either apply a smartmatch between its operand
and the topic, or it can test an expression for truthiness. See
https://metacpan.org/pod/perlsyn#Experimental-Details-on-given-and-when for
the long awkward list of how it currently determines which to use.

-Dan

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