Lisp aesthetics (and OO message passing)
Jul 20th, 2006 by Phil Dawes
The Lisp style has been really trying my sense of aesthetic.
Yesterday I got really hung up on the fact that I prefer the ‘message-passing’ approach to OO rather than the ‘call a function and pass in the object as an arg’ style. The latter just feels clumsy to me.
Then it occurred to me that lisp syntax could easily support a message passing style. E.g. I could do:
(meaning “send the ‘withdraw’ message to the philaccnt object with an argument of 10).
(philaccnt 'withdraw: 10)
Hmmm… just write a ‘class’ macro that creates a hash of lambdas and function ‘make-object’ that takes the class hash and returns a closure that dispatches the messages to method calls.
Could be something to this lisp build your own language malarky…

Add New Comment
Viewing 2 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment