--20cf3043464ec6624b04976e6c60
Content-Type: text/plain; charset=ISO-8859-1

Hello all,
in ruby c source code, there is
<http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l369>rb_define_virtual_variable like rb_*define_virtual*_variable("$~", match_getter, match_setter);<http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l369> 3370: rb_*define_virtual*_variable("$&", last_match_getter, 0); <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l370> 3371: rb_*define_virtual*_variable("$`", prematch_getter, 0); <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l371> 3372: rb_*define_virtual*_variable("$'", postmatch_getter, 0); <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l372> 3373: rb_*define_virtual*_variable("$+", last_paren_match_getter, 0); <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l373> 3374: <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l374> 3375: rb_*define_virtual*_variable("$ ignorecase_getter, ignorecase_setter); <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l375> 3376: rb_*define_virtual*_variable("$KCODE", kcode_getter, kcode_setter); <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l376> 3377: rb_*define_virtual*_variable("$-K", kcode_getter, kcode_setter); <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l377> 3378: <http://codesearch.google.com/codesearch/p?hlkOEgDIzD-Ao/trunk/lib/ruby/re.c&q█ăine_virtual&sacdct
&l378> so actually this looks like global variable, but when you get/set it, it will run thru a function, How do I do it in Ruby code? make a global variable running through my customized get/set procedure? Thanks. -- http://hi.baidu.com/femto http://bbs.aisiming.com/ --20cf3043464ec6624b04976e6c60--