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

Re: idea: everything-slices

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
June 20, 2021 12:21
Subject:
Re: idea: everything-slices
Message ID:
02f95d65-799a-4c7c-87a6-9f882f108297@beta.fastmail.com
On Sat, Jun 19, 2021, at 10:59 PM, Eirik Berg Hanssen wrote:
> On Sun, Jun 20, 2021 at 3:54 AM Ricardo Signes <perl.p5p@rjbs.manxome.org> 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.

-- 
rjbs
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