injecting imports when compiling

WebFreak001 at
Tue Dec 7 15:00:30 UTC 2021

On Tuesday, 7 December 2021 at 14:19:20 UTC, Paul Backus wrote:
> On Tuesday, 7 December 2021 at 09:54:40 UTC, WebFreak001 wrote:
>> Hi, I think it would be interesting to have a compiler flag to 
>> inject imports into all compiling .d files.
> [...]
>> Do you like this idea? Have any suggestions? Concerns?

I don't see how this suggestion is related to that Wikipedia 
link. This is also not monkey patching at all. It's suggesting 
that you can add (not replace) any symbols using a custom D file 
that would be standardized by build tool or extended further by 
the user.

This is basically extending much like you can already define 
version = X identifiers over the command line, which DUB already 
does, that you can define any other values and other symbols for 
all DUB users.

We could use this to maintain further standard environments 
outside the D compiler. For DUB this is especially interesting, 
we could greatly improve conditional compilation with more DUB 
fed information and add/remove DUB defined globals for that more 
easily, without needing to make any compiler changes.

Could you maybe explain what exactly you meant to say with that 
link, how exactly problems would be introduced by having the 
possibility to _extend or add_ standard global symbols, that can 
be overriden as usual and give errors when they are not defined?

More information about the Digitalmars-d mailing list