Good examples of version() algebra in real code

Petar Petar
Mon May 22 11:51:50 UTC 2023


On Monday, 22 May 2023 at 11:46:10 UTC, Petar Kirov [ZombineDev] 
wrote:
>
> [..]
>
> A better solution (in that it works with the existing code 
> using `static assert`s) would be having fully lazy compilation 
> model further along the lines of `dmd -i`:
> starting from set of root symbols (e.g. `main`, `unittest` when 
> unit tests are enabled, and functions explicitly marked as 
> `export`) the compiler should semantically analyse only the 
> declarations which are referenced (directly or indirectly) from 
> the root set. That way, if any symbol (be it `enum`, `struct`, 
> function, etc.) is not referenced, it won't analysed and the 
> `static assert` won't be hit.

This needs to be a different, explicitly opt-in compilation mode, 
because it would change the meaning of existing programs using 
introspectio language features like `__traits(allMembers, X)`, 
`is(X)`, `__traits(compiles, E)`.



More information about the Digitalmars-d mailing list