develooper Front page | perl.perl6.language | Postings from September 2009

Re: [perl #69194] rakudo 2009-08 and when with lists

Thread Previous | Thread Next
From:
Carl Mäsak
Date:
September 19, 2009 03:49
Subject:
Re: [perl #69194] rakudo 2009-08 and when with lists
Message ID:
16d769b70909190348h49b80cdbh984a856fce852ef@mail.gmail.com
David (>), Moritz (>>), Aaron (>>>):
>>> 2,3 constructs a list. 2..3 also constructs a list, unless it's in a
>>> given/when condition in which case it's just a range.
>>
>> No. 2..3 is always a range. It's just list context that turns it into a
>> list.
>>
>>> That seems confusing.
>
> It sounds like the split personality of Ranges strikes again.  I still think
> it makes more sense to have one Series-only type and one Range-only type,
> rather than one Series type and one Range-plus-Series type.

If for no other reason than to contribute a contrasting viewpoint, I'm
not sure I see the problem in this case. A range is an object in Perl
6, in a much more palpable way than in Perl 5. This might be what
causes the mental mismatch for Perl5-ers.

As far as I can see, the range object already is of your proposed
Range-plus-Series type, and when I apply list context to the range, I
get your proposed Series-only type (which happens to be an ordinary
list, but still).

// Carl

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