Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NQP needs "!~~" operator #300

Closed
coke opened this issue Jul 27, 2016 · 4 comments · Fixed by #462
Closed

NQP needs "!~~" operator #300

coke opened this issue Jul 27, 2016 · 4 comments · Fixed by #462

Comments

@coke
Copy link
Contributor

coke commented Jul 27, 2016

Originally opened as https://rt.perl.org/Ticket/Display.html?id=128711 by Tom Browder

NQP currently requires this:

unless $var ~~ $regex { ... }

but it would be convenient to use:

if $var !~~ $regex { ... }

@zoffixznet
Copy link
Contributor

The conversation [Coke] mentioned on the RT ticket is this: http://irclog.perlgeek.de/perl6-dev/2016-07-21#i_12882945

@arnsholt
Copy link
Contributor

arnsholt commented Aug 8, 2016

Given that NQP has ~~, adding !~~ makes sense (mirroring == and !=), IMO. But note that in NQP ~~ only works on full objects (not natives), throwing an exception if you try to smartmatch an int for example. This is why NQP has no given/when, it's simply not as useful in NQP (I implemented it at some point, but Patrick decided it wasn't useful enough to warrant inclusion, IIRC).

@jnthn, @pmichaud: Do you guys have an opinion on this?

@jnthn
Copy link
Contributor

jnthn commented Aug 8, 2016

I'm fine with a !~~ that is simply the negation of NQP's rather simpler ~~.

@tbrowder
Copy link
Member

I’m revisiting my feature request after “stressful” nqp work on Perl 6 pod tables where this would have helped my dyslexic old brain. I never checked the bug here after Coke moved it from Rakudo bug tracker, so I plan to work on this later.

Interesting recent discussion by Tom Ryder of use of “unless” in native languages as well as programming languages here:

http://blogs.perl.org/users/tom_ryder/2017/10/dont-use-until-unless.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants