DIP 1016--ref T accepts r-values--Formal Assessment

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Jan 24 08:48:37 UTC 2019


On Thursday, 24 January 2019 at 07:18:58 UTC, Mike Parker wrote:
> Walter and Andrei have declined to accept DIP 1016, "ref T 
> accepts r-values", on the grounds that it has two fundamental 
> flaws that would open holes in the language. They are not 
> opposed to the feature in principle and suggested that a 
> proposal that closes those holes and covers all the bases will 
> have a higher chance of getting accepted.
>
> You can read a summary of the Formal Assessment at the bottom 
> of the document:
>
> https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1016.md

>> fun(10)
>> ==>
>> {
>>  T __temp0 = void;
>>  fun(__temp0 := 10);
>> }
> The first problem the Language Maintainers identified with this 
> approach is that the rewrite is from an expression to a 
> statement, rendering it invalid.
> The expression should be rewritten as an expression to clarify 
> how it behaves in larger expressions.

But it does, or at least gives an example of: 
https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1016.md#function-calls-as-arguments

The statement the expression is part of is "enscoped" and the 
temporaries live in the scope of that statement.


More information about the Digitalmars-d-announce mailing list