Op 02-12-2022 om 18:38 schreef Paul "LeoNerd" Evans: > > I believe that, between them, this set of ideas and syntax could be a > useful addition to the Perl language, as a much more predictable and > controllable alternative to smartmatch. > Wouldn't this syntax be worthwhile to be generalised, so it can be used for user defined subs as well? F.i. sub my_in($needle :use($op), @haystack) { for (@haystack) { return $_ if $_ :$op $needle; } Note this is a brainstorm idea, the above has some obvious problems. First there is a syntax problem, as written it clashes with ternaries. Secondly, different operations would need $needle to be either on the LHS or RHS, but I already mailed about that in another separate mail, better to discuss that problem there first. Obviously it would be great if this would be somewhere in the future. I bring it up now because if we want it, it might have effect on the syntax of the currently proposed 'in'. HTH, M4Thread Previous | Thread Next