4 ms·
> 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 make
by catnaroek 13y ago
> 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)
- kroger 13y agoLisp 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 http://imgur.com/3vlQm6G