🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
xinming releasable6: status 13:21
releasable6 xinming, Next release in ≈6 days and ≈5 hours. There are no known blockers. Changelog for this release was not started yet
xinming, Details: gist.github.com/ab6917faa90f16cef2...b56a063a05 13:22
antononcube Is there a "quick way" to classify a string as Raku expression? Of course, I can use some of the Raku grammar packages (e.g. "Perl6::Parser") or make my own classifier, but maybe something like that is already built in. 17:01
lizmat ?try $string.EVAL 17:05
?try $string.EVAL(:check) 17:06
actually :-)
hmmmm 17:09
m: say ?try "say 42".EVAL(:check) =:= Nil
camelia True
lizmat m: say ?try "say 42+".EVAL(:check) =:= Nil
camelia False
lizmat m: sub is-raku-expression($code) { ?try $code.EVAL(:check) =:= Nil }; say is-raku-expression "42" 17:10
camelia True
lizmat m: sub is-raku-expression($code) { ?try $code.EVAL(:check) =:= Nil }; say is-raku-expression "42+"
camelia False
lizmat m: sub is-raku-expression($code) { ?try $code.EVAL(:check) =:= Nil }; say is-raku-expression "42+666"
camelia True
lizmat antononcube ^^ 17:11
note that this *WILL* execute any BEGIN blocks in the code
implicit (e.g. "use foo") or explicit (BEGIN run "naughtycode") 17:12
antononcube @lizmat Thank you! (Sorry for being slow to respond...) 18:10
lizmat you're welcome :-) 18:27