3 ms·
And then the AHA! moment happens. I finally "get" Lisp! It's just a string representation of the abstract syntax tree for any language! So instead of having a
by stcredzero 16y ago
And then the AHA! moment happens. I finally "get" Lisp! It's just a string representation of the abstract syntax tree for any language!
So instead of having a separate meta-syntax to manipulate Lisp at the level of the AST, you simply write Lisp. Lisp is the language that's it's own AST. Combine this with a complete exposure of the meta-level of the language, and you get a language where many things that would be very expensive or impossible in other languages are relatively inexpensive and possible.
Smalltalk is nearly it's own AST. There are enough tools and exposure of the meta-level to enable things like Lisp macros, but it's still 2-3X harder than in Lisp. Also, Smalltalk Blocks by themselves are fairly powerful. As a result, people don't use Lisp style macros in Smalltalk even though they could if they really wanted to. (Implementing them would just take a few days.) The cost-benefit just doesn't work out.
(Yes, even Smalltalk is a kind of "Blub" compared to Lisp.)
- sedachv 16y agoThe 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.