On Thu, Nov 28, 2019 at 04:59:46PM +0000, Dave Mitchell wrote: > I want to spend the next year or so adding lots of new features to Perl's > subroutine signatures. Thank you! This is sorely needed and will probably be the most important change to perl since, well, probably since we got signatures as they are now. I appreciate you thinking about all these proposals and bringing them together. And thanks, too, to those who have looked through or commented on them. > "Your scientists were so preoccupied with whether or not they could, > they didn't stop to think if they should." > -- Dr Malcolm, Jurassic Park Someone mentioned smartmatch somewhere in the thread and I see the parallels to an extent. In that case what I wanted in 95% of cases was a way to find out whether a scalar existed in an array and a case statement to match strings. In this case, what I want in 95% of cases (probably even more) is mandatory and optional named parameters. If we got that and nothing else I would be overjoyed. Or perhaps just relieved. I'd be happy anyway. The other features I'd use would be: On Thu, Nov 28, 2019 at 05:06:21PM +0000, Dave Mitchell wrote: ] ] $x //= $default, # use default value if arg is missing or undef ] ] bar(=$x, =$y); # short for bar(x => $x, y => $y) ] ] =head2 Auto-declare $self If the remaining features were available I can imagine using them occasionally, but > I've tried to follow the Perl philosophy of making easy things easy and > hard things possible. I think hard things are already possible, by examining @_. What's really missing is making the easy things easy. Or, at least, the common things easy. I'm not sure I'll be particularly unusual in where I'll get the most benefit from these proposals and so I suppose that what I'm saying is that I'd hate to see the enormous benefits I would get from an fairly small subset of the features proposed being endangered or even unduly delayed by the remaining features. > I intend to allow a month or so for discussions, then start work on > implementing things. I'll concentrate initially on proposals which break > backwards compatibility, with a firm goal of getting all of those into > 5.32. Other improvements will come afterwards, and may not all make 5.32. > I'll leave constraints and optimisation till last. If named parameters make it into 5.32 I'll immediately make it the minimum version for all my code ;) -- Paul Johnson - paul@pjcj.netThread Previous | Thread Next