Is it possible to make a Lisp dialect that has static types? Why cant type inference be used in Lisp instead of dynamic typing.
Name:
Anonymous2012-04-04 21:24
no
Name:
Anonymous2012-04-04 21:27
Use Racket.
Name:
Anonymous2012-04-04 22:43
>>1
It could exist if you wanted to make one. The recognizable thing about lisp is its style of syntax, which could be used for any programming language.
(define (main (argc int) (argv (pointer (pointer char)))) int
(printf "%s: Hello world!\n" (deref argv))
(if (> argc 1)
(printf "you passed %s for the first command line argument!\n" (deref (+ argv 1))))
(return 0))
But it would be convenient to have some of the nice features when writing macros. It would be kind of annoying if you had to worry about freeing parts of the syntax tree that were not used or something.
Lisp used to always have dynamic variables, but now it's standard to have lexically scoped variables. Many lisps still offer dynamic variables in one way or another.
There's nothing in the scheme standard prohibiting type inference by the interpreter/compiler for static type checking where possible, and I'd guess the same goes for Common Lisp.