Hacker News new | past | comments | ask | show | jobs | submit login
Lisp is Changing My C++ (jakevoytko.com)
33 points by mqt on Oct 6, 2008 | hide | past | favorite | 5 comments



Sometimes, the answer is no. Some boilerplate code (like exception catching) is an overhead that can not be avoided

[...]

I’m still looking for my “Lisp Enlightenment” with respect to macros

That enlightenment is just this: "boilerplate code that cannot be avoided" is an oxymoron. If it's boilerplate, it's macro-able, and exception handling is no different.

I don't know your code, so I can only suggest that you take another look at those boilerplate segments you think "cannot be avoided". Find even the smallest thing they have in common - whatever makes you call them "boilerplate". Now invent some fantasy syntax that would make that overlap go away. Now write the macro to make that syntax work. Rinse, repeat.

Warning - Once you're used to thinking like this, it is my experience that returning to a language without metaprogramming will become considerably more painful...


I think the author meant "some boilerplate code in C++ (like exception catching) is an overhead that can not be avoided."


I think the author meant "some boilerplate code _in C++_"

It's possible. But once you've acknowledged that boilerplate code is inevitable in one language but not the other, that was The Macro Enlightenment(tm) - you just had it.


Maybe the first half. The second half would be how to write such code.


Learning Python did the same thing for me. Infact I'd go as far as to say Python has made me a significantly better programmer.




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

Search: