5 ms·
The reason you can do metaprogramming with blocks in Smalltalk and not most other "OO" languages is that Smalltalk is based on message-passing, and you have con
by sedachv 16y ago
The reason you can do metaprogramming with blocks in Smalltalk and not most other "OO" languages is that Smalltalk is based on message-passing, and you have control over how objects interpret messages sent to them.
Specifically, the doesNotUnderstand method is equivalent to having a fully late-bound APPLY in Lisp (which means you can implement FEXPRs yourself when you need them, and FEXPRs are as good as CL or Scheme-style macros for many purposes):
http://carcaddar.blogspot.com/2009/04/closure-oriented-metaprogramming-via.html?showComment=1239507240000#c7399536579144180363 http://carcaddar.blogspot.com/2009/04/closure-oriented-metap...
http://c2.com/cgi/wiki?DoesNotUnderstand http://c2.com/cgi/wiki?DoesNotUnderstand
This is why Alan Kay says message passing is more important than objects.
- igravious 16y agoIs this the method_missing function that Ruby invokes when it can't fing the method to was looking for? http://www.alef1.org/ruby/method_missing/index.html http://www.alef1.org/ruby/method_missing/index.html I guess Ruby ahem borrowed it from doesNotUnderstand in Smalltalk.
- froydnj 16y agoYes, that's the same thing. It's always fun to realize that $HOT_FEATURE in $LANGUAGE is several decades old, instead of several years.