Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Globals in ruby which really are native C functions pretending to be globals.
// Ruby 2.3.1
/* eval.c:1614: */ rb_define_virtual_variable("$@", errat_getter, errat_setter);
/* eval.c:1615: */ rb_define_virtual_variable("$!", errinfo_getter, 0);
/* io.c:12280: */ rb_define_virtual_variable("$_", rb_lastline_get, rb_lastline_set);
/* load.c:1195: */ rb_define_virtual_variable("$\"", get_loaded_features, 0);
/* load.c:1196: */ rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);
/* process.c:7537: */ rb_define_virtual_variable("$?", rb_last_status_get, 0);
/* process.c:7538: */ rb_define_virtual_variable("$$", get_pid, 0);
/* re.c:3653: */ rb_define_virtual_variable("$~", match_getter, match_setter);
/* re.c:3654: */ rb_define_virtual_variable("$&", last_match_getter, 0);
/* re.c:3655: */ rb_define_virtual_variable("$`", prematch_getter, 0);
/* re.c:3656: */ rb_define_virtual_variable("$'", postmatch_getter, 0);
/* re.c:3657: */ rb_define_virtual_variable("$+", last_paren_match_getter, 0);
/* re.c:3659: */ rb_define_virtual_variable("$=", ignorecase_getter, ignorecase_setter);
/* re.c:3660: */ rb_define_virtual_variable("$KCODE", kcode_getter, kcode_setter);
/* re.c:3661: */ rb_define_virtual_variable("$-K", kcode_getter, kcode_setter);
/* safe.c:127: */ rb_define_virtual_variable("$SAFE", safe_getter, safe_setter);
/* time.c:5092: */ rb_define_virtual_variable("$find_time_numguess", find_time_numguess_getter, NULL); // #ifdef DEBUG_FIND_TIME_NUMGUESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.