4 ms·
Well, my first thought would be using macros to ensure you never have 'unsafe' strings anywhere. But, for some inexplicable reason, Joel says "Don’t use macros
by smanek 18y ago
Well, my first thought would be using macros to ensure you never have 'unsafe' strings anywhere.
But, for some inexplicable reason, Joel says "Don’t use macros to create your own personal programming language."
How is using macros to encapsulate common functionality any different than using functions to encapsulate common functionality? Both lead to less mental overhead, more code reuse, and code that's easier to parse.
- ChadB 18y agoGiven the overall theme of this rant, I would assume that it's about keeping code close together and easy to understand. Obviously, macros have almost nothing in common with functions. Macros are simply shorthand for code that will be literally placed at the spot they are called. So rather than calling functions, with all argument expressions evaluated, and a call stack, and blah blah blah, you are just copy-pasting code without it actually ending up on the screen for a developer to see.
- smanek 18y agoYou really think that macros have almost nothing in common with functions? Granted that the semantics are a little different but, in my mind, macros and functions are just two different tools that serve the same goal: allowing for code reuse. (I do understand the difference, for what it's worth. I worked as a professional Common Lisp coder for a while.)