version(number) is completely useless
Andrey Zherikov
andrey.zherikov at gmail.com
Wed Jul 20 16:30:42 UTC 2022
On Wednesday, 20 July 2022 at 14:46:40 UTC, Mike Parker wrote:
> You can use version in conjunction with enums as I do in my
> bindbc packages, e.g.
> https://github.com/BindBC/bindbc-opengl/blob/master/source/bindbc/opengl/config.d.
>
> Then you can use whichever logical operators you want on the
> enums with static if to test for library versions at compile
> time.
I'm not saying that it's impossible, there is a workaround. But
why should we have workarounds if we can have better support from
the language and compiler?
Regarding your example, IMHO there is no difference for your
users to do `dmd -version GL_46` or `dmd -define GLSupport.gl46`
but the ability to set `GLSupport.gl46` constant from command
line will simplify your code (your simply won't need `config.d`
at all).
More information about the Digitalmars-d
mailing list