|
|
|
|
|
by Roboprog
4879 days ago
|
|
You can fake objects and subclassing with closures, in addition to making it trivial to implement the "one method interface" (aka "functor"). http://roboprogs.com/devel/2010.06.html (example using a subset of JavaScript, rather than a language likely to be unfamiliar to most) TODO: edit example someday to get rid of "useless use of local variables" (in place of original formal parameters), fix where I call the outer functions "closures" instead of the inner functions. Of course, it's easier to work with both real objects AND real functions/closures/lambdas -- I can use a hammer and a screwdriver :-) |
|