Why D is not popular enough?

Shachar Shemesh via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 22 06:01:21 PDT 2016


On 21/08/16 19:31, Andrei Alexandrescu wrote:
> On 08/20/2016 11:25 AM, Shachar Shemesh wrote:
>> On 20/08/16 00:51, Walter Bright wrote:
>>> On 8/18/2016 7:59 PM, Adam D. Ruppe wrote:
>>>> Alas, C insisted on making everything int all the time and D followed
>>>> that :(
>>>
>>
>> Actually, Adam's suggestion on how things should work is precisely how C
>> works (except it trails off at int).
>>
>> a = b + c;
>>
>> if b and c are both a byte, and a is a byte, the result is unpromoted.
>> If a is a short, the result is promoted. I know the mechanism is
>> completely different than what Adam was suggesting, but the end result
>> is precisely the same.
>
> Consider:
>
> void fun(byte);
> void fun(int);
> fun(b + c);
>
> Under the new rule, this code (and much more) would silently change
> behavior. How would that get fixed?
>

Not under my suggested implementation:
> If more than one use is possible (i.e. - overloading), use the largest one applicable.

Shahcar


More information about the Digitalmars-d mailing list