...
We sometimes call the resulting objects "units", or more simply, "thats," since everything is an object in JavaScript, calling them "objects" would not be very informative. They are simple combinations of pure data and pure functions, with no unstable reliance on prototypal inheritance or any attempt to create formal "types." Methods on a that
are just plain old functions, bound directly to their object instance using a closure. As a result, methods can easily be rebound and passed around without changing their meanings. In particular, zero-arg function members can be registered as pure event handlers, without having their meaning broken—try doing that with members from a "class system" based on this
-ism!
Note that that}}
s are not suitable for use as Model Objects. Since they have an internal binding to their own {{that
member hidden in their closure, their meaning will be destroyed by an attempt to copy them with fluid.copy()
.
...