reshared this
Just spent a good half hour pulling my hair out trying to figure out why one of the #elisp functions I had just written was always returning nil when I tested it. Turns out, my test was mistakenly passing its inputs to the wrong (but similarly named) function (pivot-table-get-columns instead of pivot-table-get-body).
#Haskell's type system would've caught this. π
C's type system would also have caught it, and it isn't worth a hill of beans.
By caught it what do we mean? This is not a case of some undetected error escaping your attention due to dynamic typing. You know you got a nil which is unexpected and wrong. It's in a test case which catches it.
The only thing a type system would change is that you would instead waste a half hour not understanding how your obviously correct function call can possibly have the wrong return type.
nil is about the least useful failure state there is.
@Alessio Vanni Yeah, it's just very magic number-ey.
Ah well, such is the way it is with legacy code sometimes. No way to change it without breaking about a billion other things.
Zenie
in reply to Jonathan Lamothe • • •Should be easy to figure out.
Jonathan Lamothe
in reply to Zenie • •@Zenie That's an option, but my concern is that the reason they might be vague in the docs is because the specific error might change in future versions.
Perhaps I'm just being overly paranoid.
Zenie
in reply to Jonathan Lamothe • • •Usually errors are obvious and for very specific reasons. You can just catch them and print the message so if anything does change you will know.
I don't think it's worth worrying about.