Can’t use UFCS to create InputRange?

Paul Backus snarwin at gmail.com
Wed Apr 29 14:17:12 UTC 2020


On Wednesday, 29 April 2020 at 12:23:11 UTC, Simen Kjærås wrote:
> Of course, nothing stops us from defining our own front, 
> popFront and friends that combine the two approaches above:
>
[...]
>
> We could conceivably add these to std.range.primitives 
> (probably adding some constraints first), and suddenly UFCS 
> ranges are possible! (I am as of yet not convinced that we 
> should, though)
>
> --
>   Simen

This is basically what C++ calls "argument-dependent lookup." 
Discussion about adding this sort of thing to D has come up 
before on the forums [1], and iirc Walter has generally been 
opposed to it. If it were to be added as a library feature, it 
would probably have to be opt-in.

[1] 
https://forum.dlang.org/post/mailman.123.1472818535.2965.digitalmars-d@puremagic.com


More information about the Digitalmars-d-learn mailing list