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

Re: Revisiting smart match

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
December 17, 2017 22:20
Subject:
Re: Revisiting smart match
Message ID:
CAHhgV8hYQur+An2VCjkW5f2eXhwvChA8sHmKQR0askGKuB4o7g@mail.gmail.com
On Sun, Dec 17, 2017 at 8:39 PM, Ricardo Signes <perl.p5p@rjbs.manxome.org>
wrote:

> * Zefram <zefram@fysh.org> [2017-12-05T19:20:49]
> > I wrote:
> > >I have not yet introduced a short syntax for "when" with smartmatch,
> > >nor renamed "when".
> >
> > I have now done these, on the zefram/dumb_match branch.  The version of
> > "when" that uses its argument as a truth value is now called "whereso",
> > and the version that smartmatches is called "whereis".
> > [...]
> > The "so" and "is" particles make it pretty obvious which has which
> semantics.
>
> I realize it has been nearly two weeks since this post, and I won't push
> the
> issue, but I object to these names.  In particular, I find that last quoted
> sentence impossible to agree with.
>
> This is going to lead to confusion for learners, and native English
> speaking
> won't be the issue.  The issue will be that the two terms have no real
> clear
> distinction.
>
> The semantics are now so much better that having such unclear keywords
> would be
> a shame.  I suggest something that includes "if" or "true" for the if-like
> form, and/or something that includes "match" for the matching form.
>
>   ifcase  (...) { ... }
>   caseif  (...) { ... }
>   whenif  (...) { ... }
>   case if ( ... ) { ... }
>
>   case    (...) { ... }
>   when    (...) { ... }
>   casematch (...) { ... }
>   testcase  (...) { ... }
>   case when (...) { ... }
>
> That's the last I'll post on this unsolicited.


I have to agree. I couldn't guess the meaning of either whereso or whereis,
and I've already heard other non-native speakers complain about it.

I should also note that reusing when for smartmatch has a backwards
compatibility advantage, though without smartmatching scalars as strings
that's not particularly relevant except to those already using object
matchers such as Smart::Match provides.

Leon

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