Re:Do I Really Need a Programming Language?
by catnaroek on Sunday December 29, 2013 @01:36PM
(#6980625)
> But in the reality using macros is no more complicated than using functions.
Do I have any guarantee that the resulting macro-expanded code semantically makes sense? (e.g., a guarantee that it will typecheck)
Re:Do I Really Need a Programming Language?
by kroger on Sunday December 29, 2013 @04:18PM
(#6981432)
Lisp macros receive as input valid s-expressions, that don't need necessarily to be valid common lisp code, such as
(my-macro (2 + 2))
and output valid lisp code during macro expansion time. The macro my-macro could expand the code to something like: (+ 2 2)
Some Lisp compilers such as CMUCL will issue a warning if you try to use wrong type (it has type inference), such as in this simple example: (defmacro foo ()
`(+ 1 "foo"))
(defun bar ()
(foo))
You can see the compiler notes here: http://imgur.com/3vlQm6G
But in the reality using macros is no more complicated than using functions.
[1] http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec...
[2] http://www.common-lisp.net/project/slime/doc/html/Macro_002d...