4 ms·
Can you define "reifiable" for me? I come across it a fair bit in clojure, but I still don't really understand what the term means.
by DigitalJack 10y ago
Can you define "reifiable" for me? I come across it a fair bit in clojure, but I still don't really understand what the term means.
- gliese1337 10y ago"reifiable" = "able to be reified", where "to reify" means "to make something abstract concrete or real". So, for example, Scheme's call/cc function reifies continuations- it take a continuation, an abstract control-flow concept, and turns it into a concrete object that you can pass around and manipulate in code. Therefore, continuations are reifiable in Scheme.
- DigitalJack 10y agothank you
- ridiculous_fish 10y agoReifying means to take the abstract and make it concrete. Reflection is an example: take a language feature, like a class, and make it into real data. Many languages have some reflection capabilities for types; message sending takes this even further. For example, in Java, I can take a class and make data out of it: dynamically look up fields, etc. I can also do that with a method. But I cannot take a method call and turn it into data. I can sort of do it with a lambda, but lambdas make poor data: 1. A lambda is concrete, not abstract. It's literally "run this code." 2. Even if your lambda merely invokes a method on an object, it's still opaque. I can't pick it apart, get the parameters or method name out, etc. Here's some practical objects you can't make in Java: 1. Envelope: wraps an arbitrary remote object Contents. Any method you invoke on Envelope gets sent over the wire and invoked on Contents. 2. Delegator: represents the union of one or more objects, the Delegates. Any method invoked on Delegator gets re-sent to the first Delegate that understands it. 3. Tee: Any method you invoke on the Tee gets multicast to its wrapped objects. 4. Mapper: wraps a list. Any message you send to Mapper sends it the elements of its list, and returns the resulting list. etc. Put directly, Java method invocations are procedure calls, not messaging. But once you reify method invocations into object, it opens up all sorts of dynamic possibilities.
- DigitalJack 10y agothanks
- squeaky-clean 10y agoThe other comments have already answered this well enough. If you want a little more reading this is a nice example of an application of reification [0]. The first few paragraphs define it well, and then shows examples for implementing it for handling user/actor input and actions in a video game. [0] http://gameprogrammingpatterns.com/command.html http://gameprogrammingpatterns.com/command.html