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

Re: Limitations of Attributes

Thread Previous | Thread Next
From:
Branislav Zahradník
Date:
May 3, 2023 14:30
Subject:
Re: Limitations of Attributes
Message ID:
CAB=rbOkx-itr-QwQd9_uvGPku4iN+a0Hse2gzE+N2Qq4OPbuaQ@mail.gmail.com
>
>
> 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,
Brano

Thread Previous | 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