Worst ideas/features in programming languages?

Walter Bright newshound2 at digitalmars.com
Tue Jan 4 05:40:51 UTC 2022

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!

> I am mostly trying to figure out what 
> constitutes "unification" for you. (In the programming languages I built, 
> `int×int` and `int^2` are literally the same type, there is subtyping, but all 
> actual type conversions are explicit.)
> Personally, the single thing I care most about in terms of "unification" is that 
> this works:
> void foo(int a,int b){}
> (int,int) t;
> foo(t); // ok, function expects (int,int), and (int,int) was given
> But *not* this:
> void foo((int,int) a,int b){}
> (int,int,int) t;
> foo(t); // error, function expects ((int,int),int), not (int,int,int)
> I do not care much about `is((int,int)==int[2])`, but when you say you want to 
> unify tuples and static arrays, that's what I think of.

That isn't what I meant. I mean that there are easy ways to convert from one to 
the other, but not implicit conversions.

More information about the Digitalmars-d mailing list