From: Jesse Jones Date: 2004-08-04T09:01:31+09:00 Subject: Re: Macros in Ruby In article , Phil Tomson wrote: > While Matz may have 'banned' macros from the core language, that doesn't > mean that if someone comes up with a way to do LISP-like macros > implemented in an external module, (that could be downloaded > from the RAA for example) that Matz would ban the module. He probably > would never consider bundling it with the Ruby distribution, of course, > but that doesn't mean it would be 'banned'. This seems hard to do well. A good macro system really needs to be integrated into the language. If not, you wind up with abortions like the C/C++ macro system which is both dangerous to use and under-powered. It might be possible to do with an open compiler (ie one that provided hooks to allow third-party components to affect its behavior). I tend to be a bit suspicious of open compilers though. They seem to either lock users into particular implementations or significantly constrain compiler implementations. I'll have to think about it some more, but it seems like adding macros wouldn't be all that much more difficult to implement than opening the parser up. > It's kind of like how the static typing advocates occasionally come up > with some code for emulating static typing in Ruby (and you can probably > find some on the RAA) while most of us think that such things are > ill-advised, no one is stopping the advocates of such things from using > it. I don't see the connection. Static typing runs counter to the whole concept of typing in Ruby. Macros, on the other hand, are a completely orthogonal concept and, if anything, fit well into the Ruby philosophy of providing a flexible and expressive language. -- Jesse