From: ptkwt@... (Phil Tomson) Date: 2004-08-03T09:51:34+09:00 Subject: Re: Macros in Ruby In article <410EC9A6.5010107@neurogami.com>, James Britt wrote: >Jesse Jones wrote: > > >> Banning a feature because it can be misused is a pretty weak rationale. > >I tend to agree on this, preferring an enabling language to a B&D >language. Ruby already gives folks plenty of tools for making code >unreadable. I think most people would use macros to do the opposite: >encapsulate some abstraction to make code cleaner. > >David Alan Black mentioned macros as (possibly) a facility for >introducing arbitrary syntax. I'm no Lisper, but no examples I've seen >of Lisp macros suggest that this is what goes on. I do not think you >can use Lisp macros to get a Lisp interpreter to under truly arbitrary code. > >But, even supposing one could, I believe the Darwinian forces in a >development community would prevent abuse of macros from becoming prevalent. > Agreed. 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'. If such a module did ever become available those who would be interested in such things would use it and those who were not interested would ignore it. 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. Phil