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

Re: Limitations of Attributes

Thread Previous
From:
Ovid
Date:
May 3, 2023 15:39
Subject:
Re: Limitations of Attributes
Message ID:
CA+M4CHtJVfgPHKn_88jg8HpbwTJvH4KkN6tujw0qyLRux4OB4g@mail.gmail.com
On Wed, May 3, 2023 at 9:30 AM Branislav Zahradník <happy.barney@gmail.com>
wrote:


> 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)) { ... }
>

I have similar thoughts about this as I mentioned to Ruud. Rather than
adding a specific-attribute for a particular use case, more generalized
behavior in attributes seems to be welcome. If we do that, something like
:extends could be built on top of it (though your signature syntax wouldn't
be valid and I think that would need to be a separate proposal.

Best,
Ovid
-- 
Curtis "Ovid" Poe
--
CTO, All Around the World
World-class software development and consulting
https://allaroundtheworld.fr/

Thread Previous


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