Should we add `a * b` for vectors?

Walter Bright newshound2 at digitalmars.com
Sat Oct 7 07:24:11 UTC 2017


On 10/5/2017 1:13 PM, Timon Gehr wrote:
> On 05.10.2017 21:40, Walter Bright wrote:
>>>
>>
>> Right. But then the question becomes how much more complexity do we want to 
>> add chasing that last percent of perfection?
>>
>> For example, right now I'm in my 3rd day of attempting to resolve
>>
>> https://issues.dlang.org/show_bug.cgi?id=17635
>>
>> which is a regression brought about by layers and layers of fixes over time 
>> for a seemingly simple issue - implicitly converting a unique return from a 
>> pure function into an immutable.
>> ...
> 
> Sounds like the code might need a rewrite.

I did rewrite much of it:

   https://github.com/dlang/dmd/pull/7179
   https://github.com/dlang/dmd/pull/7186

There's a lot of accumulated technical debt in the compiler.


>> For another example, it took Martin and I months to implement the new import 
>> lookup scheme. It turned out to be fairly complicated, and there were many 
>> regressions. There are probably still issues lurking in it.
> Do you have some examples of why it is complicated? (I'm curious whether there 
> is a good way to simplify it.)

Not offhand. It's been too long since I worked on it (and then Martin more or 
less redid it). Martin deserves a lot of credit for that, it was a dirty job and 
he did it marvelously.


>> We need to keep the language rules simple enough to understand and simple 
>> enough to implement, and there will be compromises with that.
> It is however also important to not conflate implementation effort in DMD due to 
> evolvability issues with complexity of the feature. (Of course, pragmatically, 
> it will have some influence on the language design, but ideally it should not.)

Back in the early days of C++, around 1990 or so, it was popular among C++ 
committee members to say things like "compiler implementation difficulty is not 
a consideration." Well, they produced a language design that literally takes 10 
years to implement, and 10-15 years of disastrous compiler problems from all the 
vendors. It really didn't get straightened out until 2005 or so.

Even for something that's not C++'s fault, the C preprocesser, I scrapped and 
completely rewrote it 4 times, I believe. I think I finally got it right with 
Warp :-)

I've got a lot of scar tissue from "compiler implementation difficulty is not a 
consideration." I don't believe that is a necessary path to a high quality 
language. Compiler complexity is a huge red flag that something is wrong with 
the design of the language.

The compiler implementation should be a joy to read and someone should be able 
to read the spec, read the implementation of the spec, and go yeah, of course, 
this is obviously correct, it's so simple!


More information about the Digitalmars-d mailing list