develooper Front page | perl.perl5.porters | Postings from June 2021

Re: RFC: Multiple-alias syntax for for

Thread Previous | Thread Next
Nicolas Mendoza
June 9, 2021 23:44
Re: RFC: Multiple-alias syntax for for
Message ID:

Den 08.06.2021 13:20, skrev Nicholas Clark:
> So, the plan for discussing the proposed RFC process was to feed an idea
> through it, and see how we get from idea to RFC to implementation.
> (Assuming that we don't reject the idea.)
> About two months ago Rik had mentioned to me the idea of implementing this
> (currently illegal) syntax to iterate over hashes:
>      for my ($key, $value) (%hash) { ... }

I'm sorry if this is the wrong place to comment, but I see several 
comments about the proposition itself, so here goes:

I really like this, it makes life simpler.

I was wondering though:

1) since it looks like such an obvious improvement but hasn't been done 
before, is there some reason that one hasn't gone down this route 
before? Are there some hidden gotchas about it? Or is it just genius 
overlooked simplification?

2) will this work flawlessly with for instance: for my ($key $value, 
%rest) = (%hash) { … } (iterating only once)

3) will it work transparently with foreach (I believe I saw some 
comments about that)

If there is a more suitable place to ask these questions or comment, 
please enlighten me.


Nicolas Mendoza

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