From: Robert Feldt Date: 2001-10-25T17:50:15+09:00 Subject: [ruby-talk:23274] Re: Ruby macros On Thu, 25 Oct 2001, Avi Bryant wrote: > I'm also a big fan of macros, although I tend towards somewhat more > flexible metaprogramming styles (see > http://www.cs.ubc.ca/labs/spl/projects/explicit.html for a vague idea of > what I mean). However, I've had this discussion with Matz more than once, > and he is not interested in having macros in Ruby (at least, not in as > general a way as they're found in lisp and scheme). This doesn't mean we > can't add them ourselves - I've considered, for example, building an > s-expression syntax for ruby to make macros more feasible. When a few of > us were talking about this at RubyConf, Dave Thomas proposed a > construct where the "is" keyword would pass the preceding syntactic > element to whatever method followed it - ie, > > class A; end is foo > > would more or less trigger: > > foo("class A; end") > > But your idea of macro methods is interesting too - I believe the research > language Agora does something very close to this. > I'm not very familiar with Lisp's macro system but the idea seems very powerful (especially given the recent "Bruce Eckel"-thread discussion of coding standards etc). However, to me it seems as a potential drawback would be that you're effectively changing the programming language so that a future maintainer will have to learn your Ruby dialect before understanding whats happening. Or is this countered by the fact that the dialect is closer to the problem domain? > Useful work includes the recent RubyInRuby parser and Robert Feldt's Ruth > wrapping of the parse nodes in Ruby. If anyone is seriously interested in > Ruby metaprogramming (or more specifically, in the terminology of my > little research group, Explicit Programming in Ruby), let me know, as I > may have some time in the next few months to put some work into this. > Will it work as a preprocessor or dynamically? ELIDE seems to be a preprocessor. Looks interesting though, its on the checkout list! Cheers, Robert