3 ms·
module-local as in, creating a new type that can't be exchanged with the outside? Or converting the value's type on the fly when it gets passed somewhere else?
by Tobu 12y ago
module-local as in, creating a new type that can't be exchanged with the outside? Or converting the value's type on the fly when it gets passed somewhere else? I doubt either would be very usable.
Edit: the page refers to open classes, and I think the idea is that you can redefine methods on Object and have it apply to every object.
- riffraff 12y agomy understanding is that the method call is statically dispatched, and the dispatch is tweaked per module. So, if I pass a String to your api and you invoke method X it will invoke the one redefined in your module, while outside it stays the same (more like scala implicits than ruby's open classes). EDIT: to clarify how I understand this: the authors have basically decided that the module is the element of behavior specialization, and method calls are basically static functions with syntax sugar, and a class is only a data container with some default implementations for the functions.