@safe(bool)
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 17 14:28:38 PDT 2017
On 17.08.2017 20:38, HypperParrow wrote:
> 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.
AFAICT, both of those claims are exaggerations. How exactly would it be
"catastrophic"? This feature is easy to implement (basically, it just
patches together a couple of existing pieces).
More information about the Digitalmars-d
mailing list