develooper Front page | perl.perl6.users | Postings from August 2020

Extended identifiers in named attributes

Thread Next
From:
Marcel Timmerman
Date:
August 26, 2020 12:31
Subject:
Extended identifiers in named attributes
Message ID:
9d76fdf1-7f31-bcd4-41d1-5e23d0daea04@gmail.com
Hi everyone,

I was experimenting with extended identifiers and found that it is not 
possible to use it in named attributes. E.g.

> sub a (:$x:y) { say $x:y; }
===SORRY!=== Error while compiling:
Unsupported use of y///.  In Raku please use: tr///.
------> sub a (:$x:y⏏) { say $x:y; }


> sub a (:$abc:def) { say $abc:def; }
===SORRY!=== Error while compiling:
Invalid typename 'def' in parameter declaration.
------> sub a (:$abc:def⏏) { say $abc:def; }

Is there a trick of some sort to get this done? At the moment I can only 
use a slurpy hash and check for its keys. This is good enough for me but 
out of curiosity I ask. If not possible, an extra note in the 
documentation on named arguments would be necessary.

regards,
Marcel



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About