muon
muon copied to clipboard
String version comparison not supported in binary expressions
Under meson the following expression:
if '0.10.0' <= '0.20.0'
message('0.10.0 <= 0.20.0')
endif
yields: Message: 0.10.0 <= 0.20.0
Under muon, it yields a type error: error expected type int, got str
. Is this a deliberate choice?
It's a tempting thought. Meson performs string lexical sort, and it's a logic error and a project bug to use it on numbers and expect them to sort coherently.
If meson removed the ability to lexically sort strings it's entirely possible no one would ever notice except for the people who realize they should have used the version_compare method all along.
If a project can point to a valid use of this operator, I'll implement it. So far all I have seen is accidents like this where string.version_compare was clearly the intent.
If meson removed the ability to lexically sort strings it's entirely possible no one would ever notice except for the people who realize they should have used the version_compare method all along.
Would there be any appetite to deprecate this usage in Meson? As in, issue a warning when this pattern is detected stating its future deprecation and then removing it in a future version?
I'm going to close this for now as the implementation of the operator in meson seems like it was probably a mistake.