# New Ticket Created by  Geoffrey Broadwell 
# Please include the string:  [perl #125670]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125670 >


It appears you can't use an rx{} literal as a parameter default:

$ perl6 -e 'sub foo($r) { say $r }; foo(rx{bar});'
rx{bar}
$ perl6 -e 'sub foo($r = rx{foo}) { say $r }; foo(rx{bar});'
===SORRY!===
Cannot call method 'match' on a null object
$ perl6 -v
This is perl6 version 2015.06-314-g5d1ec3c built on MoarVM version
2015.06-98-gf22142b

This is golfed down from a bug causing flussence's Text-Tabs-Wrap
module Text::Wrap to no longer compile, throwing the above SORRY!
error right when it tries to parse the params to sub wrap().

Interestingly there appears to be a funky workaround:

$ perl6 -e 'sub foo($r = {rx{foo}}()) { say $r }; foo(rx{bar}); foo();'
rx{bar}
rx{foo}

Reply via email to