This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: Re: Rethinking Range

3 replies
milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.

On Thu, Oct 15, 2009 at 8:47 PM, Seth Tisue wrote:
>  Miles> To be honest I think this non-uniformity will cause as much
>  Miles> grief as it saves
>
> How?
>
> (the same question I'm asking Daniel...)

If map, flatMap and filter are differently strict then there's a
possibility of confusion which wasn't there when they all behaved the
same way.

Saying "all collections are strict, but you can obtain a lazy variant
by applying view" is nice and clear and unequivocal.

Cheers,

Miles

Seth Tisue
Joined: 2008-12-16,
User offline. Last seen 34 weeks 3 days ago.
Re: Re: Rethinking Range

>>>>> "Miles" == Miles Sabin writes:

Miles> If map, flatMap and filter are differently strict then there's a
Miles> possibility of confusion which wasn't there when they all
Miles> behaved the same way.

Miles> Saying "all collections are strict, but you can obtain a lazy
Miles> variant by applying view" is nice and clear and unequivocal.

Range seems sufficiently different from ordinary collections that I
suspect the possibility of confusion is merely theoretical. That's why
I'm looking for examples of how any confusion would arise in practice
under Martin's proposal.

Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Rethinking Range
Dear Miles,

i think that's why having separate sugar for strict/lazy that intermixes with the for-sugar is a really good way to go. The programmer declares her intention about the evaluation policy. She then can't claim surprise later.

Best wishes,

--greg

On Thu, Oct 15, 2009 at 12:54 PM, Miles Sabin <miles [at] milessabin [dot] com> wrote:
On Thu, Oct 15, 2009 at 8:47 PM, Seth Tisue <seth [at] tisue [dot] net> wrote:
>  Miles> To be honest I think this non-uniformity will cause as much
>  Miles> grief as it saves
>
> How?
>
> (the same question I'm asking Daniel...)

If map, flatMap and filter are differently strict then there's a
possibility of confusion which wasn't there when they all behaved the
same way.

Saying "all collections are strict, but you can obtain a lazy variant
by applying view" is nice and clear and unequivocal.

Cheers,


Miles

--
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com
Roland Kuhn
Joined: 2008-12-26,
User offline. Last seen 3 years 14 weeks ago.
Re: Re: Rethinking Range

On Oct 15, 2009, at 21:54 , Miles Sabin wrote:

> On Thu, Oct 15, 2009 at 8:47 PM, Seth Tisue wrote:
>> Miles> To be honest I think this non-uniformity will cause as much
>> Miles> grief as it saves
>>
>> How?
>>
>> (the same question I'm asking Daniel...)
>
> If map, flatMap and filter are differently strict then there's a
> possibility of confusion which wasn't there when they all behaved the
> same way.
>
> Saying "all collections are strict, but you can obtain a lazy variant
> by applying view" is nice and clear and unequivocal.
>
Sure, read like this it's true. However, I submit that the average
Scala programmer expects a guard in a for-expression to be evaluated
like it were included in the body, which means lazy. But this point
may well be moot, given Martin's other proposal from yesterday (http://www.nabble.com/Rethinking-filter-p25906315.html
). That, in combination might be the real solution.

Regards,

Roland

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland