Hacker News new | past | comments | ask | show | jobs | submit login

I wonder if using a generic procedure would work better than redefining + outright. If you opened up Ao and typed (+ 1 1) at the REPL, would you see 2 as the result or a token object?



The redefined + only behaves differently when one or more of its arguments is a token object, so normal math works fine.

Generic procedures may be a cleaner way to do this, but I only discovered GOOPS after this implementation was already working.


>The redefined + only behaves differently when one or more of its arguments is a token object, so normal math works fine.

Ah yes, I'm just blind and missed the implementation in your article. Thanks for explaining!




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: