From: Eric Hodel Date: 2007-08-12T18:06:59+09:00 Subject: Re: global_variable_set (like instance_variable_set) On Aug 11, 2007, at 23:29, Marc Heiler wrote: >> What problem do you need this for... it sounds like you could get by >> with a different (and better) approach, but we'd need to know a >> little >> more about what you're trying to do. > > > I believe for the record, a non-eval solution will be interesting > to see > either way, even if he would use another (better) approach :-) $ ruby require 'rubygems' require 'inline' module Kernel inline :C do |builder| builder.include '"ruby.h"' builder.c <<-'EOF' static VALUE global_variable_set(char * varname, VALUE object) { return rb_gv_set(varname, object); } EOF end end p global_variable_set 'foo', 5 -:17: warning: parenthesize argument(s) for future version p $foo # I hit ^D here 5D 5 -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars