Folks,

has someone ever written a `safe define' macro that makes the defined
macro expands to itself if called without any argument?

  sdefine({foo}, {bar})

  foo    =>  foo
  foo()  =>  bar

I tried the following, and I failed (due to lack of experience
w.r.t. quoting tricks, I think) – I have difficulties to delay the
expansion of `$#'...

Below, I've marked the problematic spots with (nonexisting)
pseudo-functions.

  define({sdefine},
    {define({$1},
       {ifelse(delay_expansion_of({$#}),
               {0},
               {{$1}},
               {expand_at_definition_time(shift($@))})})})


    Werner

Reply via email to