Ranges and @safe
SrMordred
patric.dexheimer at gmail.com
Sun Sep 22 23:03:32 UTC 2019
I think that .front in ranges should'nt be safe by default.
@safe{ iota(0,0).front(); } //BOOM, but compiles on @safe.
I can put a @system on front method, but then
@safe{ foreach(v ; range){ ... } } //dont compile, its not safe.
But i think that this lowered code should at least be @trusted
since the algorithm is using the range correctly and can´t do
unsafe things (right?).
I can wrap the range in opApply and solve this, but its a dirty
trick i think.
What's your ideas on this?
all the code i'm talking here:
https://run.dlang.io/is/yPy26j
More information about the Digitalmars-d
mailing list