Question. In which namespace `B` is defined?
A = Class.new do
B = 1
A::B # => ???
B # => ???
More on the topic https://fili.pp.ru/leaky-constants.html
@phil_pirozhkov very interesting. Away from IRB, I’m trying to figure out if this is a lexical scope thing, or a block/closure thing, or both… my hunch is it’s mostly the former though.
@james Couldn't find a better answer than this https://github.com/rspec/rspec-core/issues/2181#issuecomment-190535022
@phil_pirozhkov congrats on the Ruby Weekly mention! It's a shame that the headline contained the slightly misleading explanation though, but still. Nice! :)
Seems they've added it before I've made a correction to the article basing on your lexical scope remark.
A Mastodon instance for Rubyists & friends