4 ms·
There is a programming language property called Restrictability - it means that you only need to know a subset of the features the language provides to become p
by pkd 9y ago
There is a programming language property called Restrictability - it means that you only need to know a subset of the features the language provides to become productive. The best languages have high restrictability without compromising on the high level features like powerful macros.
The point of having macros is that they allow you to solve problems that cannot be solved elegantly in any other way. But 95% of programmers don't need to solve such problems and can do very well without using macros.
- alphaalpha101 9y agoBut then you don't have real macros. Real macros, as in Lisp macros, are good because they aren't experts-only. Macros are used by all Lisp programmers, all the time, and they're just another tool in the basket.
- nnq 9y ago> Restrictability - it means that you only need to know a subset of the features the language provides to become productive Thanks, but.... NO THANKS! It's basically what makes languages like Scala or C++ horrible - a false sense of "you only need to know this subset of the language" and then you see that in real life: (1) nobody agrees on what that subset is and (2) you are going to have to hack your way through the most advanced frameworks and libraries (written by folk way smarter than you) and you are going to need to do it under unreasonable time pressure! If a feature exists in the language you will be forced to understand it and become proficient at using it, whether you like it or not. Otherwise you're a "play pen programmer", only comfortable in his little patch of expertise. I'm personally an "Expert Generalist" and like to be confident I can hack my way through anything this shitty life throws at me ;) This is kind of why I'm starting to love forcefully minimalistic, abstraction-wise-rigid, and intentionally "retarded" languages like Go nowadays :) (But yeah, when dynamic is the way to go, I'd prefer a Lisp with macros any time - one extreme or another, never the middle way, I'm not smart enough for it.)
- kazinator 9y ago> it means that you only need to know a subset of the features the language provides to become productive. That only works when you work by yourself (or in a small team to whom you can dictate the language subset), and without any third party code. > But 95% of programmers don't need to solve such problems and can do very well without using macros. Languages that have great macro systems use them to bootstrap themselves. So when you use the standard, documented features, you're using macros. E.g. if you're writing in Lisp and your file begins with (defun ..., you've just used a macro.
- pkd 9y agoSure, you can use them as a consumer all the time, but that doesn't mean that you need to write your own to program in Lisps, for instance. For the few that do need it, it's a worthy tool to have.