More tricky range semantics

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 15 17:51:25 PST 2015


On 1/15/15 4:46 PM, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Jan 15, 2015 at 03:24:29PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
>> On 1/15/15 12:53 PM, H. S. Teoh via Digitalmars-d wrote:
>>> Passing a range to a function may invalidate it unless you use .save.
>>> Therefore, one should *always*  use .save.
>>
>> That's right. To simplify the problem space we might decree that
>> forward (or better) ranges with reference semantics are not allowed.
>> -- Andrei
>
> That's not workable. It instantly makes InputRangeObject useless.

Indeed. That said we could achieve polymorphism with value objects; it's 
just more complicated. I agree it's a tricky matter. -- Andrei


More information about the Digitalmars-d mailing list