ruby / English

Other
28 stars 7 forks source link

Provide information how to find additonal global variables used by ruby #2

Closed JuPlutonic closed 1 month ago

JuPlutonic commented 3 years ago

E.g. $" <=> $LOADED_FEATURES $: <=> $LOAD_PATH those sometimes apeared in the ruby bug tracking system.

This information I can't find in gem English, but I want it to provide reference either in README.md in additional section "References / Other ENVs" or in lib/English.rb comments.

olleolleolle commented 3 years ago

👋 @JuPlutonic

You can find them listed in the documentation comments in the source code, for example:

https://github.com/ruby/English/blob/master/lib/English.rb#L20

The generated documentation seems to not include every useful documentation comment, but only the table of English name to short-form name.

https://ruby-doc.org/stdlib-3.0.2/libdoc/English/rdoc/English.html

That seems to be a problem.

Thanks for reporting this.

JuPlutonic commented 3 years ago

Wow, I found. So if you don't understand some of global variables (and they are not described in English) you could search a ruby code for $X, or better for rb_define_hooked_variable("$X" part.

rb_define_hooked_variable("$X", &rb_ruby_c_api_function, ...)

So actually rb_ruby_c_api_function-s name and it's file name it is located (e.g.io.c) will give you a clue what does one of such variables do. @olleolleolle you could close the issue or maybe you interested in $LOADED_FEATURES / $LOAD_PATH addition to English (I don't know is it enough to find undocumented short global variabes like $" / $: and their long versions to permit adding they to English).

JuPlutonic commented 3 years ago

https://github.com/ruby/ruby/pull/3670 found bunch of RACTOR related gvars (only short forms like $-v) and also don't know is it (gem English) right place to describe them…

olleolleolle commented 3 years ago

To be more clear: the alias calls in the class in this repo are documented in very clear ways. These documentation strings are not emitted as published documentation, though. It would be cooler if they were.

hsbt commented 1 month ago

https://docs.ruby-lang.org/en/master/globals_rdoc.html may helps you.