Worst ideas/features in programming languages?
Timon Gehr
timon.gehr at gmx.ch
Tue Jan 4 06:37:02 UTC 2022
On 04.01.22 06:40, Walter Bright wrote:
> On 1/3/2022 6:06 PM, Timon Gehr wrote:
>> On 03.01.22 10:27, Walter Bright wrote:
>>> On 1/2/2022 11:42 PM, Timon Gehr wrote:
>>>> And there is also this:
>>>>
>>>> void foo(T...)(T args){}
>>>>
>>>> int[2] x;
>>>>
>>>> foo(x); // foo!(int[2]) and foo!(int,int) would now need to be the same
>>>
>>> With such implicit conversions, the language would just descend into
>>> chaos. So no :-)
>>
>> It's not an implicit conversion.
>
> Looks like it to me!
> ...
If `foo(int, int)` is defined to be literally the same as `foo(int[2])`,
there is no conversion. But anyway, I guess you'd also consider anything
that would make this work an "implicit conversion"?
double foo(int x,string y);
writeln([(1,"2"),(1,"3"),(3,"4")].map!foo);
If so, maybe one way to make _some_ progress on this is to have a DIP
specifically for destructuring, without adding any new types?
More information about the Digitalmars-d
mailing list