On Thursday, 17 August 2017 at 17:21:16 UTC, Timon Gehr wrote:
On 17.08.2017 18:36, HyperParrow wrote:
On Thursday, 17 August 2017 at 16:32:20 UTC, bitwise wrote:
[...]
Yeah, i like it more than
https://github.com/dlang/DIPs/blob/master/DIPs/DIP1012.md.
That makes little sense to me, as DIP 1012 is strictly more
general.
template safety(bool safetyOn){ // (this can even be in core)
static if(safetyOn) alias safety = FunctionSafety.safe;
else alias safety = FunctionSafety.system;
// else alias safety = infer!FunctionSafety; // even better!
}
struct Container(T, bool safetyOn = true){
static if(safe) RefCounted!(T[]) data;
else T[] data;
auto opSlice() @safety!safetyOn {
return Range(data, 0, data.length);
}
}
The application of DIP 1012 would have catastrophic effects on
the current tooling but as usual nobody thinks to that.