kjana / dm4lab.to (YANAGAWA Kazuhisa) writes:

> Well, I've proposed once that we have Symbol.new or Symbol.gensym,
> which acts like gensym in Lisp or Scheme.  Yes, it is not necessary in
> this case since we can make unique IDs in process life long by
> something like a counter, but gensym make some works clean.
> How do you think?

I've had occasional need for something similar.  
The following seemed to suffice:

class Gensym
  def initialize (label=:g, cnt=0)
    @label = label
    @cnt   = cnt
  end
  def next
    sym = format("%s%d", @label, @cnt).intern
    @cnt += 1
    return sym
  end
end  # class Gensym

g = Gensym.new(:foo)
g.next

or

g = Gensym.new("g-%s-" % $$)


Regards,

Raja