Phobos uses opSlice and opDollar without checking for it

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed May 25 09:24:01 PDT 2016


On Wed, May 25, 2016 at 03:05:33PM +0000, qznc via Digitalmars-d wrote:
[...]
> Can we provide opSlice and opDollar implicitly for random access ranges?
[...]

P.S. If you're talking about using UFCS to provide fallback
implementations of opSlice / opDollar, I don't think that's possible
because operator overloading doesn't work with UFCS.

Besides, how would you even implement opDollar if the range in question
is infinite? It's perfectly legit to take a slice [n .. $] of an
infinite range, since $ doesn't need to be an actual value. But you
couldn't implement such a thing outside the range implementation itself.


T

-- 
It always amuses me that Windows has a Safe Mode during bootup. Does that mean that Windows is normally unsafe?


More information about the Digitalmars-d mailing list