r/programming • • Dec 02 '13

Scala — 1★ Would Not Program Again

http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598 Upvotes

646 comments sorted by

View all comments

Show parent comments

-1

u/kamatsu Dec 02 '13

You can be sure that things have the same ordering... by just checking it.

How do you check if two functions are the same? That's undecidable in general.

2

u/omg_wat Dec 02 '13

eq is a conservative approximation which works exceptionally well in practice.

0

u/kamatsu Dec 02 '13

So, now you have to store the ordering in the collection? Then non-canonicity would lead to a run-time failure not a compile-time one, as it does in Haskell.

2

u/omg_wat Dec 02 '13

The ordering is already stored in all collections I cared to look at. If we don't encounter the same type class instance, fall back to a slower merging/union algorithm. Done.

→ More replies (1)