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

Re: Revisiting smart match

Thread Previous | Thread Next
December 19, 2017 03:37
Re: Revisiting smart match
Message ID:
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 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.


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