www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - OpEquals in Dmd

reply Lucian Danescu <lucidanescu28 yahoo.com> writes:
Hello everyone!

I thought I'd ask before diving straight into an implementation. 
I am using dmd as a library and I have a use case where being 
able to compare AST nodes would be really helpful.

My question is: is this doable in DMD, or is it a reason it 
hasn't been implemented so far? Do you guys consider it would be 
a valuable addition to DMD, or it wouldn't go through?
May 07 2023
parent Paul Backus <snarwin gmail.com> writes:
On Sunday, 7 May 2023 at 17:34:53 UTC, Lucian Danescu wrote:
 Hello everyone!

 I thought I'd ask before diving straight into an 
 implementation. I am using dmd as a library and I have a use 
 case where being able to compare AST nodes would be really 
 helpful.

 My question is: is this doable in DMD, or is it a reason it 
 hasn't been implemented so far? Do you guys consider it would 
 be a valuable addition to DMD, or it wouldn't go through?
Most likely the reason it hasn't been implemented is that DMD itself doesn't need to compare AST nodes in order to compile D code. For the same reason, my guess is that such code would not be accepted as a contribution, because the DMD developers would not want to take on the job of maintaining code that DMD does not use. If you would like to make your AST comparison code available to other projects that use DMD as a library, I would recommend publishing it as a separate package on code.dlang.org. You can list the [official `dmd` package][1] as a dependency. [1]: https://code.dlang.org/packages/dmd
May 07 2023