Re:Statically Typed Lisp
by tempodox on Thursday November 13, 2014 @03:35AM
(#8600507)
This is, of course, correct and I do use that technique in SBCL myself, but it still doesn't make SBCL a statically typed language (even if SBCL has the strictest type checks and the best native code generation I've seen in an open-source Lisp to date). The static typing in OCaml, Haskell - heck, even C is still another thing.
[ Parent
| on HN ]
I don't know OCaml or Haskell, but I think you're mistaken about C. Given the following C code:
char *foo(char *bar) {
return bar;
}
int main(int argc, char *argv[]) {
foo(1);
return 0;
}
I get compile-time warnings from clang substantially similar to what SBCL emits: $ cc test.c
test.c:6:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'char *' [-Wint-conversion]
foo(1);
^
test.c:1:17: note: passing argument to parameter 'bar' here
char *foo(char *bar) {
^
1 warning generated.
I'm sure that with suitable flags set, both compilers would throw type errors at compile-time instead of warnings.