3 ms·
As someone that uses Java in my dayjob, I wish annotations were never invented. Debugging problems with them is hell. Why can't we just use method calls?
by bcrosby95 6y ago
As someone that uses Java in my dayjob, I wish annotations were never invented. Debugging problems with them is hell. Why can't we just use method calls?
- pjmlp 6y agoBecause method calls don't compose as compiler plugins or runtime reflection. They were also not invented by Java, other languages like Dylan, Python and .NET actually go them first. Actually they are like a poor man's Lisp macros kind of.
- deleted 6y ago[deleted]
- 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]