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

Re: idea: everything-slices

Thread Previous | Thread Next
Ricardo Signes
June 20, 2021 12:21
Re: idea: everything-slices
Message ID:
On Sat, Jun 19, 2021, at 10:59 PM, Eirik Berg Hanssen wrote:
> On Sun, Jun 20, 2021 at 3:54 AM Ricardo Signes <> wrote:
>> This provides an easy way to get all the keys and values of an array, which pairs nicely with multi-target for:
>> for my ($i, $v) (@array[*]) {
>>   ...
>> }
>   Typo: s/@array/%array/

This was a typo.

> So … are there any traps in confusing everything-slices with Zen slices?
> Alterntively, are there traps in confusing everything-slices with Raku's Whatever-slicing (which gets the star)?

I am not keen on "nothing" as a signifier.  Consider that right now, @array[()] produces an empty list.

I don't like that a pair of empty parens, put seemingly where one expects a list, are different to putting nothing.  Better that each kind of nothing act like the other, and that something different looks different.

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