r/Clojure • • Dec 18 '18

Clojure 1.10 error messages

http://insideclojure.org/2018/12/17/errors/
92 Upvotes

23 comments sorted by

View all comments

Show parent comments

3

u/alexdmiller Dec 19 '18

The error message phase here is in printing the return value. So it can’t be printed, because that is where the error occurs. A lot of lazy sequence errors end up looking like this.

This particular error is a case where the invocation is wrong (args swapped), which is really a perfect case for a spec or precondition, to avoid constructing a broken lazy seq. I’ve been thinking we should probably improve the particular “can’t cast to IFn” too since it’s so common.

1

u/xtreak Dec 19 '18

Thanks for the reply. I guess there had been attempts to spec clojure's core functions but they were abandoned due to various reasons. I would love to see upcoming improvements.

2

u/alexdmiller Dec 19 '18

https://github.com/slipset/speculative is ok and has a spec that would catch this.

1

u/xtreak Dec 19 '18

Thanks!