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

Re: Revisiting smart match

Thread Previous | Thread Next
From:
Zefram
Date:
December 19, 2017 03:37
Subject:
Re: Revisiting smart match
Message ID:
20171219033727.GT25404@fysh.org
Karen Etheridge wrote:
>- why is there a need for two words?

There isn't a *need* for it, and indeed an earlier version of my branch
had only one, taking a truth value.  But Ricardo commented on the context
implying the use of predicates, which is what smartmatch provides, so
the conclusion is that there's value in having a shorter syntax here
for smartmatching on $_.

>- why is this word simply not 'where'?

That's used by MooseX::Types, for condition-based subtyping.  We're not
strictly bound to avoid such conflicts, but having a conflict with such
a popular module would cause quite a bit of hassle to users.  That's a
pity, because "where" was otherwise a rather good word.

>why can't 'when' simply be repurposed here?

It can, but it has some disadvantages.  Repurposing it for something
so incompatible is liable to surprise people who used the old version,
but that could be ameliorated by mucking about with the feature.pm layer
(make the feature non-default for 5.28, change its name).

Picking one word on its own doesn't help a great deal as long as we're
looking for a pair of words.  The relationship between the two words
is important.

-zefram

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