3 ms·
Yes. The Common Lisp spec says you can put declarations a lot of places, including prog: http://clhs.lisp.se/Body/s_declar.htm http://clhs.lisp.se/Body/s_decl
by martincmartin 16y ago
Yes. The Common Lisp spec says you can put declarations a lot of places, including prog:
http://clhs.lisp.se/Body/s_declar.htm http://clhs.lisp.se/Body/s_declar.htm
So you can basically wrap it around any S-expression you want.
When I was at ITA we did that a lot. For example, there was a macro i+ that would expand to basically "the two arguments are fixnums, as is the result. Now, please give me the sum."
In debug builds, the type declarations would be come assertions. In release builds, they'd become assumptions, i.e. the whole thing would compile to a single x64 ADD instruction.