From: Robert Dober Date: 2007-03-12T21:41:44+09:00 Subject: Re: #define alternative for Ruby On 3/12/07, Timothy Hunter wrote: > Mike wrote: > > Just try to implement: > > set_default(var, val) > > -- if variable "var" is not defined (not existed) then assign value > > "val" > > > > I'd like to point out that you can't do that with #define, since C > macros are processed before the compiler runs, and whether or not "var" > is defined is not known until the compiler runs. > > Although I am against macros it might be worth pointing out that of course it can be done #define MYDEFINE var val \ var = val unless defined? var forgive me if the syntax is incorrect. The Ruby interpreter will not see the macro and vice versa. BTW on Linux I guess you can always use gcc to preprocess files anyway, but STAY AWAY FROM THIS. Sorry for shouting, but I wanted to be heared ;) Cheers Robert -- We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous