Unfortunately, operator overloading gives you a limited vocabulary (search the Boost devel list for several debates over operator connotation, or justifying an unusual choice due to precedence rules). Furthermore, operator overloading and other function-based approaches cannot perform code refactoring that requires changing evaluation rules, introducing variables, etc. (unless you're wielding monads in an ML variant). C++ has made great strides using templates for metaprogramming; but I dare you to say templates are easier to comprehend than macros. The Boost Preprocessor library would not be necessary if templates were as powerful as macros.Destruct1 wrote:DSL are important and arithmetic operations are not special. However it is possible to implement this kind of
behavior in Python (and other languages) with operator overloading.
I dont get Macros
Re: I dont get Macros
Re: I dont get Macros
If you want to truly bask in the true glory of lisp and macros you should read
http://www.paulgraham.com/onlisptext.html
And then once you think youve seen it all you can take a good look at continuatiosn:
http://common-lisp.net/project/cl-cont/, partial evaluators (hu.dwim.partial-eval), code walkers (hu.dwim.walker), and customizable reader macros (hu.dwim.reader):
All of which (well not the continuations) expands the power of macros! Hail to the macros!
OK, i think paul graham does a better job of selling lisp in the first few pages of on lisp
http://www.paulgraham.com/onlisptext.html
And then once you think youve seen it all you can take a good look at continuatiosn:
http://common-lisp.net/project/cl-cont/, partial evaluators (hu.dwim.partial-eval), code walkers (hu.dwim.walker), and customizable reader macros (hu.dwim.reader):
All of which (well not the continuations) expands the power of macros! Hail to the macros!
OK, i think paul graham does a better job of selling lisp in the first few pages of on lisp