In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Now, if you want to tell me that, despite all the talk, Lisp coders don't > actually create new syntax or mini-languages all that often, that they > just use macros as functions, then the question becomes: why do you need > macros then if you are just using them as functions? Why not use functions?
Well, as a user of both lisp and python, it seems to me that python programs can create their own domain-specific mini-languages using mechanisms such as objects, classes and functions. It's quite possible to mask the bare-bones python behind functions and objects derived from imported libraries, which themselves might not be python-native. And extreme advocates of functional programming raise the same arguments about objects: they create obfuscated constructs that are difficult to read and understand without unpacking their internals. The questions could be asked, why do you need objects if you are just using them as containers for functions? Why not just use functions? Python already is very explicit about supporting OOP, a paradigm that bundles functions and data into larger constructs. So why is it that many of these debates center around macros, which is another paradigm that bundles functions and data into larger constructs? Both objects and macros have IMO similar potential for abuse and obfuscation. But to answer your question, I use a macro when I have a problem that can't be easily reduced to a naive function. I also use object classes when I have a problem that can't be easily reduced to a simple data type. When I don't need an macro or an object class, I just use naive functions and simple data types. -- http://mail.python.org/mailman/listinfo/python-list