Feature to get or add value to an associative array.

ag0aep6g anonymous at example.com
Fri Apr 20 08:56:37 UTC 2018


On 04/20/2018 10:24 AM, Nick Treleaven wrote:
> On Wednesday, 18 April 2018 at 16:47:50 UTC, ag0aep6g wrote:
>> You can get a pointer from the ref return:
>>
>>     Value* p = &aa.slot("key", { inserted = true; return Value.init; });
> 
> This is not @safe, even with -dip1000:
> 
> Error: cannot take address of ref return of f() in @safe function main

Hm. Do you know why that's not allowed? I can't see how it would be less 
safe than returning a pointer, and I can't find a mention of it in DIP 
1000 [1]. Maybe it's just a case of incomplete/buggy implementation?


[1] https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md


More information about the Digitalmars-d mailing list