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

Re: Revisiting smart match

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
December 17, 2017 19:39
Subject:
Re: Revisiting smart match
Message ID:
20171217193928.GA20980@debian
* 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.

-- 
rjbs

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