develooper Front page | perl.perl5.porters | Postings from November 2019

Re: Type and Value Constraints and Coercions

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
November 30, 2019 16:23
Subject:
Re: Type and Value Constraints and Coercions
Message ID:
20191130162253.04729283@shy.leonerd.org.uk
On Thu, 28 Nov 2019 17:04:42 +0000
Dave Mitchell <davem@iabyn.com> wrote:

> 5) This is a tentative suggestion that would replace options 3) and
> 4). This would be for a constraint hook to be specified as a
> empty-bodied sub with a single parameter. The constraint(s) specified
> for that parameter become the custom constraints which that hook
> provides. In some fashion the code previously compiled for that
> "prototype" sub's constraint is copied and/or executed. This would be
> more efficient than calling a whole sub for each parameter, and would
> more constrained than injecting text into the source code. 

This would be non-trivial to implement, but I have a growing collection
of situations in which I would love to be able to copy (partial)
optrees from one sub into another. I've often found it doesn't quite
work in a naive approach but I suspect a proper effort into making it
work wouldn't be that difficult. Somewhat outside of the scope of
signatures as such, but it may be worth us collecting up a list of
situations this could help with, to motivate an effort into looking at
making it work.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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