3 ms·
Why are you depending on a variable which will be defined in a module which is expected to import your module?
by patates 10y ago
Why are you depending on a variable which will be defined in a module which is expected to import your module?
- Karunamon 10y agoThis was from an old version of an IRC project.. basically, the main script sets up a $APP_CONFIG variable, which is the hash parsed version of a yaml config file. The files being included, which were plugins, could (and in reality, can) read this variable. In short: If you run a Ruby program that sets up global variables, other ruby files required after that point can access those variables, even though Rubymine seems to think otherwise. This is documented in the program output linked to that bug report.
- nine_k 10y agoHow prevalent is this practice? Is it considered a good, or at least acceptable, practice? I suppose the developers mostly fix issues that affect many people, and affect reasonably written, idiomatic code. Name resolution in a highly dynamic language like Ruby is somehow tricky, and may be resource-hungry, especially in corner cases that you described.
- smw 10y agoYeah, that doesn't seem like the sort of thing anyone reasonable would do.
- Karunamon 10y agoIt's unreasonable to have a configuration dictionary? ..Whatever. I love how both of you focused on the one example and completely ignored the two others. Have another one - Mako syntax highlighting in Pycharm has been broken for over a year now. https://youtrack.jetbrains.com/issue/PY-17932 https://youtrack.jetbrains.com/issue/PY-17932