T. Onoma wrote:
>
>has anyone given any thought to having macros in ruby?
>

Ruby isn't a compiled language so you wouldn't gain a whole lot with some
sort of macro language in addition to what ruby already offers. You have
eval and instance_eval in Ruby, both of which accept strings as parameters
so you essentially have the ability to create your own macros:

def add_foo_method(o, name, result)
    o.instance_eval %{
        def #{name}
            #{result}
        end
    }
end

o = Object.new
add_foo_method(o, :coolness_level, 10)
o.coolness_level  #=>  10

def new_class(name, code)
    eval %{
        class #{name}
            #{code}
        end
    }
end

new_class "A", %{
    def hi
        puts "hello world!"
    end
}

a = A.new
a.hi #=> "hello world!"

You can abuse this technique, but it has it's place.
___________________
John Long
www.wiseheartdesign.com