@safe(bool)
Nicholas Wilson via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 17 15:55:32 PDT 2017
On Thursday, 17 August 2017 at 18:38:40 UTC, 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.
How? In the Simplest terms DIP1012 replaces Keyword attributes
with enums. Yes, libdparse would have to be updated, but that is
the case for any substantial DIP. Hardly 'catastrophic'.
More information about the Digitalmars-d
mailing list