From: pjb@... (Pascal J. Bourguignon) Date: 2009-01-31T18:55:03+09:00 Subject: Re: global generator of unique symbols Thomas Hafner writes: > Hello, > > is there a global generator of unique symbols? See article > why that can be needed. There I > have defined myself a generator, but that's no real solution: if > software is going to be put together from different libraries, only > one common generator should be used by all software parts to prevent > symbol clash. > > With ``generator of unique symbols'' I mean: the first time since > program start it will generate any symbol. Any other time it will > generate a symbol that differs from all already generated symbols. > > Regards > Thomas (@@gensym_counter = 0) (def gensym(base = "com_informatimago_ruby_g") (@@gensym_counter = (@@gensym_counter + 1)) ((base + (@@gensym_counter . to_s)) . to_sym) end) (gensym) --> :com_informatimago_ruby_g5 You could use org_eu_nl_hafner_faun in your symbols, and bet nobody else will use that prefix. -- __Pascal Bourguignon__