3 ms·
Looks like a missing "occurs check." http://en.wikipedia.org/wiki/Occurs_check http://en.wikipedia.org/wiki/Occurs_check If so, it should be a relatively easy
by finnw 15y ago
Looks like a missing "occurs check." http://en.wikipedia.org/wiki/Occurs_check http://en.wikipedia.org/wiki/Occurs_check
If so, it should be a relatively easy fix.
- DanielRibeiro 15y agoActually seems to be a bit more involved: according to the submitter[1] Java is trying to prove something that is undecidable on Java's current type system. To solve it you'd have to make it stricter. [1] http://www.reddit.com/r/programming/comments/mlbna/scala_feels_like_ejb_2/c31zdbd http://www.reddit.com/r/programming/comments/mlbna/scala_fee...
- exDM69 15y agoUnfortunately, adding an occurs check here is not the right way to go. The possibility of an infinite loop is there for a reason (to make the generics more expressive) and adding an occurs check will make the language less expressive. I don't see a problem with non-terminating compilation. It makes sense to add more power to the compiler, but it comes at a cost. The possibility of non-termination is not a huge price to pay for it. In practice, the recursion will never go very deep so a simple max recursion depth check is enough to keep the compiler from hogging cpu and memory.