RE: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Mark Devine
Easy for you to say... (haha) Nice! Many thanks. Mark From: Vadim Belman Sent: Sunday, September 8, 2019 21:32 To: Mark Devine Cc: perl6-users Subject: Re: Wrap an attribute’s ^get_value method in TWEAK Here is a quickly hacked together example: multi trait_mod: (Attribute:D $a,

Re: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Vadim Belman
Here is a quickly hacked together example: multi trait_mod: (Attribute:D $a, :$xmlattr!) { my $mname = $a.name.substr(2); my = my method { say "ATTR($mname):", my \val = $a.get_value(self); val }; _name($mname); $a.package.^add_method($mname, ); } class Foo { has $.foo is

RE: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Mark Devine
Vadim, Vadim, Would you be able to expand on how to implement the trait that wraps into what is effectively the ‘get_value’ accessor of an attribute? I’m not finding enough in the documentation to connect the dots. I’ve looked at XML::Class, which does some pretty heavy trait’ing, but my

Re: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Vadim Belman
Hi Mark, get_value won't give you what you expect. It's use is narrowly limited to trait 'is handles' and method .perl. Besides, are you sure all of your attributes will be considered as belonging to XML? I mean, won't there be need for utility attributes serving exclusively internal needs of

Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Mark Devine
Perl6 Community, How do I properly wrap an attribute’s ^get_value method in TWEAK? If a condition exists, I’d like to wrap all (:local) attributes so that they can do some extra work. The module that I’m working on has classes/attributes for hundreds of fields in dozens of different, big XML

Re: Variable character class

2019-09-08 Thread Laurent Rosenfeld via perl6-users
Because sets are unordered collections of items. And the (&) operator returns a set. Le dim. 8 sept. 2019 à 00:18, Aureliano Guedes a écrit : > Why does it dont return ordered for neither of those lists? > I mean: > > my $u = "24680"; > my @s = $u.comb.unique; > say @s ; # [2 4 6 8 0] > > sub