On 28 November 2016 at 21:53, Dave Mitchell <davem@iabyn.com> wrote: > what about: > > for (...) { > eval '$#'; > } Yeah. That's the annoyingest part of this idea. I don't know how to make that seem unweird. If we take a different tack and propose, instead of some arcane magic, that we define a new keyword, > for_idx That can take *two* variables: for_idx my $key, $value ( @array ) { ... } Then we get the benefit of explicitness, the benefit of clarity, and the benefit of working even in evals. Theoretically, this idea could even be prototyped on CPAN. If anyone goes in this direction, may I also tempt them with: for_assoc my $a, $b, $c ( @array ) { } Which would be a "more perlish" way of the sort of idea people are trying to get over in the signature introspection thread, and it would be really awesome if that gave us something like for_assoc my $key, $value ( %hash ) { } #justsayin But as you can see, this is kinda bikeshed territory: Its clearly the sort of thing we all hate bumping into all the time as a feature that perls missing, but its not really that clear how we should implement it sanely. So CPAN prototypes would be really nice to prove which strategy is the nicest for Perl. I'm not in any hurry to shoehorn one of these proposals into Perl wrongly. :) -- Kent KENTNL - https://metacpan.org/author/KENTNLThread Previous | Thread Next