How can we make it easier to experiment with the compiler?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon May 24 05:55:08 UTC 2021


On 5/23/21 10:56 PM, Walter Bright wrote:
> I recently had to talk someone out of having dmd/backend import files 
> from dmd/root.

One problem with that is code duplication. There are two types OutBuffer 
in frontend and Outbuffer in backend that are 95% identical, yet 
duplicated. Recent improvements (two distinct) will need to be 
duplicated to the other, which is clearly not a good way to go.

How to address this problem?

I think all of us looking to improve dmd's architecture would be well 
served by reading this book:

https://amazon.com/gp/product/0135974445/

Really close, cover to cover. A lot of the principles in that book are 
either applied with good results (sadly not as often as one would hope), 
or not, with the expected poor outcome, in dmd's codebase. For example, 
this:

> A good rule of thumb is:
> 
>     *** Never import a file from an uplevel directory ***
> 
> Import sideways and down, never up. 

is an approximate formulation of a subset of Dependency Inversion Principle:

https://en.wikipedia.org/wiki/Dependency_inversion_principle


More information about the Digitalmars-d mailing list