develooper Front page | perl.perl5.porters | Postings from September 2015

Re: smartmatch needs your eyes

Thread Previous | Thread Next
Ricardo Signes
September 17, 2015 03:57
Re: smartmatch needs your eyes
Message ID:
* Ricardo Signes <> [2015-09-10T11:26:08]
> [ blah blah blah ]

1.  It sounds like we really want to have '~~x' and 'x~~' overloads, with '~~'
    deprecated, since the two forms are totally different.

2.  People still really want to match literals.  when (1) { ... }

    That's understandable.  The question is whether when has two special cases
    or whether you can say ($x ~~ 10) to mean ==, just for the sake of keeping
    when(EXPR) defined purely in terms of ~~.

    Between the two, I think we should allow a literal on the rhs of ~~.

    Upside:  lots of given/when switchy code just works

    Downside: people confused that when($x=5) is not the same as when(5)

    I think the upside wins.  The error message can be made clear.


I think we should get these changes done, then smoke CPAN for any
super-critical breakage, and move forward.

Tony:  think this is something you could make happen?


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