Why does Scala-lang not just provide approximately equals comparisions?

@BalmungSan problems sometimes using 3rd party libs are that in some cases you might find non-serialisable implementations and regarding using Java implementations it even sometime also applies that you cannot easily make use of those. The nice thing about Scala is that there you always get things out-of-the-box, e.g. serialisability via case classes, etc.
That being said, if I would be aware of any lean Scala lib doing GPS things (and handling precision issues properly), I would love to use it :slight_smile:

My motivation to bring this discussion up was that a lot of unit-testing frameworks implement this equality out-of-the-box, but using unit-testing code in production is nothing we should consider. That is why I would really be in favour if this would come with scala-lang (in some way, cannot solve it for all use cases probably, but the most common one, where you can read it from books might be a good start).

You can use scalatic which is intended to be used in production code.
Also, again, the simple and somewhat generic solution is two lines of code that you can add in a utils package of your project without too much problem.

The argument for not having that two lines solution in the stdlib is that, as you can see in this discussion, such solution is simply too fragile for many other cases. Thus, it would lead to topics like this one proposing changes or adding other alternatives.

1 Like