Range Redesign: Copy Semantics

Nick Treleaven nick at geany.org
Wed Jan 24 12:26:43 UTC 2024


On Tuesday, 23 January 2024 at 18:21:47 UTC, Paul Backus wrote:
> (If your response to this is "ok, we'll just have 
> isForwardRange explicitly reject pointers", keep in mind that 
> this problem also applies to generic wrapper types that use 
> `alias this` or `opDispatch`. Are we really going to tell our 
> users that it's their fault if their code breaks because they 
> put a range pointer inside one of these types?)

`isForwardRange` could require the range *type* to have `empty, 
front, popFront` defined. Not sure if that solves your `alias 
this`/`opDispatch` points. This would mean arrays would need the 
range methods built-in rather than using UFCS.



More information about the Digitalmars-d mailing list