Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haxelib version testing #5920

Open
ncannasse opened this issue Jan 4, 2017 · 7 comments
Open

haxelib version testing #5920

ncannasse opened this issue Jan 4, 2017 · 7 comments
Milestone

Comments

@ncannasse
Copy link
Member

I used (some long time ago) to be able to do the following:

#if (mylib >= 3.2) ... #end

This does not seem to be working anymore with float literal. String literal works however.

@Simn
Copy link
Member

Simn commented Jan 4, 2017

I think that"s a feature, comparing semver versions as float is terrible.

@ncannasse
Copy link
Member Author

Could we not simply handle it (by detecting that a semver with a small regexp ?

@ncannasse
Copy link
Member Author

(I think we can actually detect 3.1 vs 3.10 since it"s at the AST level)

@ibilon
Copy link
Member

ibilon commented Jan 4, 2017

That"s not haxelib specific, all defines are strings, so applying numerical comparison on them doesn"t make sense.

Though it would be useful to have,
maybe through a macro call or something? #if @semverGE(mylib, 3.2.0)
which could be useful for advanced conditional compilation without scripting it in bash/equivalent.

@ncannasse
Copy link
Member Author

@ibilon I know that defines are strings in Haxe

I think that silently failing on float comparison is much more troublesome than implementing some dynamic comparison. If we assume that 3.3 == "3.3" and compare the float string against the version it should work quite well

@ibilon
Copy link
Member

ibilon commented Jan 4, 2017

If we assume that 3.3 == "3.3" and compare the float string against the version it should work quite well

Only if there"s only one digit though,
and the version also has a patch so equality comparison won"t work.

@Simn
Copy link
Member

Simn commented Jan 7, 2017

If we assume that 3.3 == "3.3" and compare the float string against the version it should work quite well

At the moment the parser does the exact opposite: If it finds TString op TFloat it tries to do (float_of_string TString) op TFloat.

@Simn Simn modified the milestone: 4.0 Jan 9, 2017
@Simn Simn modified the milestones: Release 4.0, Design Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants