Interestingly, if you call you glue "reflection" and "annotations" or "attributes" and not "combinators" and use them in a modern language with good editor support, it becomes a reason to deride a language.
Java for example has some very interesting ways to meta program it, for example you can relatively easily dynamically select a number of classes based on different features and say for example: "apply all these to the input and count each output as a vote on an input."
But except for when listening to or talking to long time users I never hear about it. Two reasons off the top of my head (but I guess there are many more):
- many educators teach Java in an extremely uninspiring way.
- the long and sad history of old enterprise Java (and later, Spring, although Spring was a force for good for a while)
Edited to mention "attributes" as well as good editor support.
Really intrigued by your comment. Can you please elaborate on the part of meta programming in java. I am trying to learn it in java. What will you suggest to someone who is working in java for a while to dive deep into it?
I’m not the parent poster, but what they likely meant are annotation processors. They are basically a compile time mechanism that can create new classes based on the used annotations in the program (important, they can’t modify existing classes! This is so that reasoning about the code is easier).
This is mostly used by libraries and is seldom used for actual applications (I mean, annotation processors themselves, ones implemented by libs are definitely common), for example MapStruct is a really cool library that generates mapping code between two classes, one can specify which field/property maps to which and thus making a common, error-prone operation very readable and easy to maintain.
With that said I disagree with the original statement that one should absolutely know/use these tools, similarly to macros in other languages these are very advanced/last resort mechanisms that are very great in that rare chance they are needed, but overuse of them can make code very hard to understand.
Annotations (like @Entity in JPA/Hibernate) and reflection is what I mean.
Several Java libraries use annotations in a good way and also once one masters Java, they aren't too bad to make oneselves.
Reflection is about taking decisions and even changing behavior at runtime, like "iterate over all classes in this package, filter the ones with name pattern/annotation (or whatever other information is available at runtime) and use/update them.
Reflection is very powerful and IMO somewhat more tricky than annotations.
Java for example has some very interesting ways to meta program it, for example you can relatively easily dynamically select a number of classes based on different features and say for example: "apply all these to the input and count each output as a vote on an input."
But except for when listening to or talking to long time users I never hear about it. Two reasons off the top of my head (but I guess there are many more):
- many educators teach Java in an extremely uninspiring way.
- the long and sad history of old enterprise Java (and later, Spring, although Spring was a force for good for a while)
Edited to mention "attributes" as well as good editor support.