Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That looks like an annoying problem. Really need a decimal type for that.

As an aside has anyone tried making Python object notation? For instance you'd get tuples, sets, complex, hex, etc. along with dicts, lists, and all the other stuff json has. I know you can use literal eval but it has some security issues json doesn't have.



Realistically, a decimal type with defined precision is just a coverup for the real problem which is that version numbers aren't decimal numbers. If "1.2" < "1.19" < "1.20" that's not a decimal number and treating or storing it like one is a problem. I've seen this time and time again in software projects where someone treats the version number as a decimal, which works great right up until they have more than 9 minor versions, someone adds a bugfix version or someone adds a beta/alpha suffix. Then a whole bunch of stuff breaks that was making bad assumptions.


That's a very good point. I guess we need a version type? Or something.


Starlark, used in Bazel, is in that vein, though goes a bit further by supporting functions (with many restrictions): https://github.com/bazelbuild/starlark/tree/master




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: