Proposal: Object/?? Destruction

Timon Gehr timon.gehr at gmx.ch
Fri Oct 6 19:51:39 UTC 2017


On 06.10.2017 21:43, jmh530 wrote:
> On Friday, 6 October 2017 at 19:31:11 UTC, Timon Gehr wrote:
>> The proposal is to make all arguments "single type arguments". The 
>> "single type" might be a tuple. A tuple type is just a type, after 
>> all. For two current functions where only one matches but after the 
>> change both would match, the same one would still be selected, because 
>> it is more specialized.
>>
>> [snip]
>> Then the call foo(2) will still go to the first overload and the call 
>> foo(1,2) will still go to the second overload, while the call 
>> foo(1,2,3) will still go to the third overload.
> 
> 
> So under your thinking, the original example should have been something 
> like:
> 
> ---
> auto id(T)(T x){ return x; }
> 
> void main(){
>      auto a = id(2); // ok, a is 2.
>      auto b = id(1,2); // error, b is not single type argument
>      auto c = id(1,); // ok, c is 1.
>      auto d = id((1,2)); // ok, d is (1,2)
>      auto e = id((1,)); // ok, e is (1,)
> }
> ---

No, under my thinking the original example should have been what it was.
Enclosing an expression in an additional set of parentheses does not 
change its semantics. This is true even if one set of parentheses is 
part of the function call.


More information about the Digitalmars-d mailing list