whateverable icon indicating copy to clipboard operation
whateverable copied to clipboard

More ways to trigger evalable

Open AlexDaniel opened this issue 8 years ago ‱ 7 comments

<seatek> say '123abcg' ~~ /<xdigit + [g]>+/
<seatek> m:say '123abcg' ~~ /<xdigit + [g]>+/
<seatek> m: say '123abcg' ~~ /<xdigit + [g]>+/
<camelia> rakudo-moar 906719: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␀Quantifier quantifies nothing␀at <tmp>:1␀------> 3say '123abcg' ~~ /<xdigit +7⏏5 [g]>+/␀»

m: without a space should work. Also, perhaps it should be able to figure out that say 
something
 should be executed as well. How often people start their sentences with “say” for other reasons? If there are any false positives, perhaps also check if the message has too many symbols or something.

AlexDaniel avatar Oct 19 '16 22:10 AlexDaniel

I had another thought, anything that results in a "useless use of", also try the same thing with 'say ' in front and return both results.

MasterDuke17 avatar Oct 19 '16 22:10 MasterDuke17

This is exactly the reaction I was hoping for: https://irclog.perlgeek.de/perl6/2017-05-18#i_14599572

AlexDaniel avatar May 18 '17 19:05 AlexDaniel

I think this can be closed. Would be great to have more tests though.

AlexDaniel avatar Aug 02 '17 21:08 AlexDaniel

Maybe we should make it harder to trigger. Example: https://irclog.perlgeek.de/perl6/2017-09-05#i_15118238 The message in question actually looks like code. However, I've noticed that all times that we have evalable trigger on something we don't want to, it is always with non-zero exit code. So let's check the exit code before printing anything.

AlexDaniel avatar Sep 06 '17 11:09 AlexDaniel

Leading space triggers both evalable and camelia: https://irclog.perlgeek.de/perl6/2018-02-03#i_15773390.

AlexDaniel avatar Feb 03 '18 15:02 AlexDaniel

Somehow @jnthn++ is triggering evalable unintentionally, all the time.

<jnthn> m:g does multiple matches, and <( )> set the limits of the matching
<evalable6> jnthn, rakudo-moar 38afa2d6f: OUTPUT: «(exit code 1) ===SORRY!=== Error while compiling /tmp/O2Rtjzi3To␀Two ter »
<evalable6> jnthn, Full output: https://gist.github.com/eea772e80efd46824cfd08cf7403a759
<jnthn> Oh, be quiet, evalable6 
<jnthn> | sleep &
<evalable6> jnthn,  rakudo-moar 890d628a2: OUTPUT: «Use of uninitialized value of type  Callable in numeric context␀ in block <unit> at /tmp/T »
<evalable6> jnthn, Full output: https://gist.github.com/6233b79f46e6a3beb6420821bcce405a

These can be simply special-cased, I don't remember any other false positive.

AlexDaniel avatar Dec 17 '18 19:12 AlexDaniel

I fixed it a little bit in https://github.com/perl6/whateverable/commit/a32bb6009c202cbdc1a26f00668798856d7450fd, but m:g is still triggering, so that should be special-cased too.

AlexDaniel avatar Aug 25 '19 21:08 AlexDaniel