protocol for using InputRanges

Paolo Invernizzi paolo.invernizzi at no.address
Fri Mar 28 01:59:34 PDT 2014


On Friday, 28 March 2014 at 00:41:42 UTC, Walter Bright wrote:
> On 3/27/2014 3:23 PM, QAston wrote:
>> The protocol is not intuitive.
>
> I find empty-front-popFront as perfectly intuitive. I don't 
> find the counter proposals, which come with baggage like 
> constructors that may fail, and front() that may fail in 
> unspecified ways, or throwing entire paradigms out the window, 
> as intuitive.
>
> But I concede that other people think differently. Not everyone 
> thinks the same. But consider this: floating point math is not 
> intuitive. There has never been a shortage of proposals to make 
> fp intuitive, but they've all failed because they are 
> impractical.
>
> Sometimes ya gotta go with what works.

I _strongly_ agree with Walter: people learning D in my groups 
have no problems with the empty-front-popFront sequence.

Please don't complicate or change the notion of range: you can 
find an adjustment that don't break code, but for sure that will 
break the mindset of people.

For what concern us, everyone here is happy with the fact that 
empty *must* be checked prior to front/popFront.

--
Paolo


More information about the Digitalmars-d mailing list