3 ms·
>Actually they are like a poor man's Lisp macros kind of. Best description of annotations I read. Literally this, a lot of times I figure an annotation is way
by thecupisblue 6y ago
>Actually they are like a poor man's Lisp macros kind of.
Best description of annotations I read.
Literally this, a lot of times I figure an annotation is way simpler than fighting the generic system and all it's flaws.
- kazinator 6y agoIn fact, I invented a new kind of Lisp macro, the parameter macro, which decorates functions, but at compile time rather than run-time, and with much more flexibility. https://www.nongnu.org/txr/txr-manpage.html#N-00B4065C https://www.nongnu.org/txr/txr-manpage.html#N-00B4065C An example is given of a memoization parameter macro that you invoke simply by adding :memo to the front of the parameter list, as in (lambda (:memo ...) ...). This inlines everything; the function itself rewritten to do the caching with open code, rather than wrapped with a caching function. TXR Lisp's support for keyword arguments is also implemented as a parameter macro, using the documented define-param-expander public interface. http://www.kylheku.com/cgit/txr/tree/share/txr/stdlib/keyparams.tl http://www.kylheku.com/cgit/txr/tree/share/txr/stdlib/keypar... This is possible because the parameter macro can introduce identifiers into the scope of the function, and rewrite the parameter list.
- deleted 6y ago[deleted]