version(number) is completely useless

Andrey Zherikov andrey.zherikov at gmail.com
Wed Jul 20 04:06:04 UTC 2022


On Wednesday, 20 July 2022 at 03:18:15 UTC, Hipreme wrote:
> It is virtually impossible to recreate the mess macros done. 
> They were so messy because one could define AND undefine them, 
> which made tracking a lot hard.

I agree, this is bad use case and I'm glad that D didn't allow it.

> Even worse, macros were used for everything. Constants, inline 
> functions, templates, syntax transformers, aliases, conditional 
> compilation, importing.
>
> D has already solved that by creating specific tool for each 
> thing

Right and I believe that setting compile time constants in 
compiler command line would benefit everyone.

> giving a way to define version as a namespaced number would 
> hardly make anything more complex. If you take the use case i 
> bring for example, you you actually check it would make it 
> easier to understand

I think that `version(V >= 5)` is not harder to understand than 
`version(V.5)`. But `V >= 5` clearer defines that it's true when 
V==6 which is not obvious with `V.5` - you need to get used to 
that.



More information about the Digitalmars-d mailing list