Proposal: Object/?? Destruction

Timon Gehr timon.gehr at gmx.ch
Thu Oct 5 19:45:52 UTC 2017


On 05.10.2017 17:23, Seb wrote:
>>>
>>> auto {success, message} = callVoldermortFunction();
>>>
>>>   This is concept is used in Kotlin. JavaScript es6 takes it even 
>>> further (function parameters and arguments support object destruction)
>>>
>>>
>>
>> Why curly braces? Multiple function arguments are a form of built-in 
>> tuple, so the syntax should be consistent:
>>
>> auto (success, message) = callVoldemortFunction();
> 
> 
> I think I can state the opinion of many D users here: I don't mind 
> whether it will be curly braces or round parentheses - the important 
> thing is that we will be able to use it in the foreseeable future :)
> 
>> The only unresolved question is (as using the result of the comma 
>> operator has been deprecated already): How to write a unary tuple. My 
>> favourite is what python does: "(3,)". This is however already 
>> accepted as a function argument list. I think it is worth breaking 
>> though. Maybe we should deprecate it.
> 
> +1

I'll create a DIP as soon as I can.


More information about the Digitalmars-d mailing list