John Knight wrote:

> After I sent my comment out, I started to think about the lack of macros in ruby.
> I am not sure  I understand how block structures replace macros.
> They may replace closuress but macros?
> Actually I am in over my head at the moment.
> John


Hope you didn't forget link on that web site to more details:
http://www.paulgraham.com/lib/paulgraham/bbnexcerpts.txt

"One way we used macros was to generate Html.  There is a very
natural fit between macros and Html, because Html is a prefix
notation like Lisp, and Html is recursive like Lisp.  So we had
macro calls within macro calls, generating the most complicated
Html, and it was all still very manageable."
--quote from link above

(A side note: function call regarding to parameters is in ruby
prefix notation too, just like in any other common language :-))

This can be done in dynamic object oriented language too,
with ruby blocks it is quite easy and pretty too.

look at cgi ruby library
some examples are at:
http://www.pragmaticprogrammer.com/ruby/articles/cgi.html

exmaple from the link above:

require "cgi"
   cgi = CGI.new("html3")  # add HTML generation methods
   cgi.out{
     cgi.html{
       cgi.head{ "\n"+cgi.title{"This Is a Test"} } +
       cgi.body{ "\n"+
         cgi.form{"\n"+
           cgi.hr +
           cgi.h1 { "A Form: " } + "\n"+
           cgi.textarea("get_text") +"\n"+
           cgi.br +
           cgi.submit
         }
       }
     }
   }

This is very nice code.
Do you think that the macros could be better
at generation of html? I don't.

Jakub Travnik
jabber://jtra / jabber.com
ICQ: 66770334 (deprecated)