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

Re: Type and Value Constraints and Coercions

Thread Previous | Thread Next
Paul "LeoNerd" Evans
November 30, 2019 16:23
Re: Type and Value Constraints and Coercions
Message ID:
On Thu, 28 Nov 2019 17:04:42 +0000
Dave Mitchell <> 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      |  |

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