Paddy wrote: > Ravi Teja wrote: > > BJörn Lindqvist wrote: > > > > Personally, I would like to see macros in Python (actually Logix > > > > succeeding is good enough). But I am no language designer and the > > > > community has no interest in it. When I absolutely need macros, I will > > > > go elsewhere. > > > > > > One must wonder, when is that? When do you absolutely need macros? > > > > Whenever there is significant boiler plate code that functions and > > classes cannot eliminate alone. > > Whenever there is a more elegant way to express your code. > > > > Me, I am torn. I should now better. I have listened to the arguments > against Macros in Python and the ones that struck home were the > argument for maintainability: > Without macros, Python is Python. Statements do what you expect.
Yes! I heard those arguments too. And I am not convinced. Static language programmer: Lack of static typing removes the necessary safeguards. The code is more error prone. Objects have behavior that is not obvious. Dynamic language programmer: Really? I don't seem to have any more bugs than in my statically typed code. And my code is compact and reads better. I don't want to go back. No to macros proponent: Macros introduce a lot of potential for abuse. Code will be worse to read than Perl. Macros proponent: Really? We have been doing macros for decades. We all think our code is better for macros, not worse. We are not going back. I just don't get it. Don't we often invoke the "We are all adults here" argument. Writing a macro is not as simple as writing a function. Sort of like metaclasses. Many will stay off them. Those that really need them will walk that extra mile. Don't we all believe that "Simple should be possible. Complex should be doable" > And the argument against DSLs altogether: > Make Python your DSL! If you design your own DSL before long you start > to embellish it with more statements or data types and before long it > becomes complex. If you used Python from the beginning then you would > have a community for support. Python has a low cognitive overhead. But it not a DSL by definition. No language can be. The idea is that when the domain changes, a DSL should be driven by the new domain as warranted. In other words, driven "by the problem, not the tool". I don't want "a DSL". I want a language that allows me to make "my DSL" based on it. That means I don't loose the community connection. I can still use all the rich libraries in my DSL. I like Python for its indentation syntax, sensible semantics and readability. I invested a lot of time in Python. After much language hopping, I settled with Python. I like the community and the code base available for it. The libraries just seem to be designed at the right level of abstraction for me (as opposed to say, Java). When I need to do something, I know where to go. But all this ties me to the language tightly that I cannot change. > I know the arguments, but every once in a while I think if only I could > craft my own ??? statement or .... My thoughts exactly. Web frameworks, which seem to be the rage now in Python community could have benefited tremendously from Macro capabilities since they have a lot of boiler plate. -- http://mail.python.org/mailman/listinfo/python-list