3 ms·
Yes, during compilation. (defun foo (x) (compile () `(lambda (u) (print "Executed")
by junke 11y ago
Yes, during compilation.
(defun foo (x) (compile ()
`(lambda (u)
(print "Executed")
(aref ,x u))))
(foo 0)
... reports a compilation error and of course does not print anything. If however I directly type the offending form (aref 0 0) a runtime type error is signaled.
- scott_s 11y agoI believe that is still quite different from the technique presented by the authors. Their technique applies at program execution, but prior to the execution of the individual functions. What you're showing is all prior to program execution.
- TeMPOraL 11y agoNo, this is during program execution. Lisps blend compile time and run time together. You always have a compiler available, so you can compile new stuff (and recompile existing stuff) in the middle of your program's execution. And compile-time typechecking occurs whenever you compile.
- junke 11y agoThe type analysis happens only after I enter "(foo 0)" in the REPL, which is execution time.