As far as I (and the docs) know, slurpies can only be used with array or hash parameters. However, I recently typo'ed the syntax and entered what looks like it would be the syntax for a scalar slurpy. Much to my surprise, this didn't result in a syntax error. After some experimentation, I determined that the following are all allowed:
sub f(*$a) {}
sub g(**$a) {}
sub h(+$a) {}
I couldn't, however see what (if anything) this syntax did. So what's going on? Is this an under-documented feature? A bug that's causing invalid syntax not to throw an error? Something else altogether?
So what's going on? Is this an under-documented feature? A bug that's causing invalid syntax not to throw an error? Something else altogether?
Its undocumented and broken behaviour. It was speculated it would have different behaviour. It's a filed bug. See Slurpy scalar parameters (and duplicate https://github.com/Raku/old-issue-tracker/issues/5656) for further discussion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With