develooper Front page | perl.perl5.porters | Postings from May 2023

Re: Limitations of Attributes

Thread Previous | Thread Next
Branislav Zahradník
May 3, 2023 14:30
Re: Limitations of Attributes
Message ID:
> use Custom::Sigs 'SEARCH';
> sub function :signature(SEARCH) {...}
> And replace SEARCH with the results of the sub call without nasty eval
> hacks. I'm actually working on some code to try to handle the latter case,
> but so far I've been using the Marpa parser to develop a BNF grammar to
> parse the Perl code in the attribute and install the signature. It's very
> painful.
just repeating my previous idea - what about `extends` for functions? eg:

package Foo {
    sub SEARCH (... signature ...);

sub function :extends(&Foo::SEARCH) { ... }

later extended signature support for setting fixed value (in opposite to
default value) of parameter, eg:

sub function :extends(&Foo::SEARCH) ($search_key := value = q (fixed
value)) { ... }

Best regards,

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About