Phobos uses opSlice and opDollar without checking for it

qznc via Digitalmars-d digitalmars-d at puremagic.com
Thu May 26 14:41:46 PDT 2016


On Thursday, 26 May 2016 at 06:07:36 UTC, Jonathan M Davis wrote:
> At this point, generic code should just never use opDollar 
> unless it specifically tests for it, and usually, there's 
> really no reason to do that rather than just using length at 
> this point, much as it's far more aesthetically pleasing to use 
> $. But ranges really should support $ just like arrays do, so 
> the current state of things is definitely annoying.

The most common uses are [$..$] and [x..$]. I think those should 
simply be fixed to take(0) and drop(x) from the range primitives. 
They are as aesthetically pleasing, generic for any ranges, and 
efficient for arrays.


More information about the Digitalmars-d mailing list