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

Re: smartmatch needs your eyes

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
September 17, 2015 03:57
Subject:
Re: smartmatch needs your eyes
Message ID:
20150917035731.GA24684@cancer.codesimply.com
* Ricardo Signes <perl.p5p@rjbs.manxome.org> [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?

-- 
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