What do people mean with "reified"?

A good way to think of reified is that it means that the program is aware of its programming and can change it, or you might say it is aware of itself and has the ability to modify itself.

To map it to the dictionary definition, you would think of source code for example as the abstraction, and the running program of that compiled source as the concrete representation of it. If the program can access its source code, and can generate more running program from it, such as how you can in Clojure call source on a function, get the source back, and then you can call eval on that source to get back a new running concrete version of that source, then the program source is reifiable, and reifying a function would be the act of taking its source (the abstraction) at runtime and evaluating it again at runtime into a new concretion.

Similarly, a spec is an abstraction, and a concrete value that is valid to the spec would be its concrete realization.

Similarly a type is an abstraction, and a concrete value of that type in memory is its concrete realization.

Similarly an interface or a protocol is an abstraction, and an object or map implementing that interface or protocol is its concrete realization.

Whenever the abstraction for some thing still exists, and can be used to generate more concrete realization of itself, or regenerate/replace existing concrete realization of itself with new ones, we say that the thing can be reified.

That’s why the reify function is called reify, because it can take an abstraction such as an interface or protocol, and generate a new concrete implementation of it.

Two things are needed for something to be reifiable, you need the abstraction to be available, and you need the ability to generate new concretions from it, and optionally replace existing concretions with new ones.

So let’s say you had a regex matcher, and if at runtime you still have the abstraction for it, it means you’d still have access to the regex string for it. And if you could generate more matchers from that regex string, or modify the regex string and generate more matchers from it, you could say that your regex is reifiable. On the other hand, if you no longer have access to the regex string that was used to compile the matcher, or if you have access to it, but cannot use it to create more matchers from it, then your regex would not be reifiable.

4 Likes