Arc Forumnew | comments | leaders | submitlogin
2 points by jimbokun 4368 days ago | link | parent

"Personally I prefer the approach in SICP ( )."

I was negligent in citing prior work. I had SICP in mind when I wrote my code.

The main differences are I wrapped it all up in a macro, I supported inheritance, and "method invocations" require one less set of parentheses:

    (define acc (make-account 100))
    ((acc 'withdraw) 50)
    ((acc 'withdraw) 60)
    "Insufficient funds"
    ((acc 'deposit) 40)
    ((acc 'withdraw) 60)
I also didn't allow for initial arguments (yet). And you need to say "(vars 'varname)" to get values in method bodies instead of just "varname." I could probably fix both those things together.

But, generally speaking, the goal was to provide a macro for creating SICP style "objects."

1 point by NickSmith 4368 days ago | link

Be interested to read your code Jim with your 'fixes'.