4 ms·
>But why don't they? Aren't the problems nearly the same? And if not, how? Concrete example: Common Lisp is very strongly typed. So it almost never automatical
by flavio81 9y ago
>But why don't they? Aren't the problems nearly the same? And if not, how?
Concrete example: Common Lisp is very strongly typed. So it almost never automatically converts from type to another, except when it makes total sense (i.e. the square root of -1 will return a complex number).
So, if there is a type mismatch, it will be caught (at runtime) raising an exception. Now, you would think "yeah but my statically typed language will check this BEFORE the code runs". Yes, but in Lisp, the exception doesn't terminate the execution, it enters a mode in which the system asks you what to do next.
Thus, what you do is, you go back to the source code, to the function with the error, you correct that specific function, compile that specific function (which happens almost instantly), and then resume execution of your program. This means that the previously "invalid operation" will be run again but with the new definition of your function, thus the code will continue running without said bug.
So, all in all, it's very nice to use...
- skohan 9y agoThat sounds very nice to work with, and for tools/scripts running on my own workstation it sounds great. For user-facing code running at scale catching more errors at compile-time still sounds better to me.