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

Re: Revisiting smart match

Thread Previous | Thread Next
Dan Book
December 19, 2017 03:38
Re: Revisiting smart match
Message ID:
On Mon, Dec 18, 2017 at 10:07 PM, Karen Etheridge <> 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 for
the long awkward list of how it currently determines which to use.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About