Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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-metap...

http://c2.com/cgi/wiki?DoesNotUnderstand

This is why Alan Kay says message passing is more important than objects.



Is 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

I guess Ruby ahem borrowed it from doesNotUnderstand in Smalltalk.


Yes, that's the same thing. It's always fun to realize that $HOT_FEATURE in $LANGUAGE is several decades old, instead of several years.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: