4 ms·
I use preprocessors for Java. I'm not averse to using them when I have to work in a more verbose language. And you are right that we often don't have a choice
by lliamander 4y ago
I use preprocessors for Java. I'm not averse to using them when I have to work in a more verbose language.
And you are right that we often don't have a choice of language to work in.
But they are still a sign that the language you are using is deficient. Preprocessors may ameliorate those problems somewhat, but they come with their own costs and complexities.
For anyone who is in the position of making a language choice, the fact that a given language community relies heavily on such tools should be a reason to avoid that language.
- zasdffaa 4y agoNow this is an answer I can work with! I completely agree they represent a language deficiency and that should be rectified within the language, but that's not always practical than or even possible. Sometimes you have to fiddle with the language at the lexeme level [edit: at the token level, messing about with single keywords for example], which most (all?) most templates/generics won't allow you to do. Also the input to a code generator can be heck of a lot more compact and readable than the code it outputs, as that's a win. Heavily modified example based on my actual code (no animals harmed): makeClasses = [ ("Dog", "chases", "Cat"), ("Fox", "eats", "Chicken"), ... each line of which produces a small class. Also completely agree they come with their own costs, but sometimes the cost is lower than the cost of not using code generation.