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

Re: RFC: Multiple-alias syntax for for

Thread Previous | Thread Next
From:
=?UTF-8?Q?Branislav_Zahradn=C3=ADk?=
Date:
June 10, 2021 23:15
Subject:
Re: RFC: Multiple-alias syntax for for
Message ID:
CAB=rbOmLt1eR9zJ1YfbP+5g7+oj8NxmGVrwpHsFfMpEnKybn4w@mail.gmail.com
> I have often wanted that sort of thing (I call them "adverbs") in a
>
> First problem is that the syntax is too ambiguous:
>
>
Syntax issues avoided on "block API" concept with "alter meta operator"

Example of multi item traversal:

for (@list) {
    has $item;
    ...
}

for (@list) {
    has $item1;
    has $item2;
    ...
}

for (@list) {
    has $item1;
    has $index1 := :is => Array::index;
    has $item2 := :is => Array::next;
    ...
}

More at
https://github.com/happy-barney/perl-poc/blob/perl-features/COP/tests/traverse-multiple-items.t

Whole concept:
https://github.com/happy-barney/perl-poc/tree/perl-features/COP

Alter meta operator - preparing standalone RFC.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About