What does it mean to pollute the global namespace?

In ruby, some gemstones prefer to "pollute the global namespace."

What does it mean? How can I see where this is happening?
Why should pearls do this?

When faced with two gems that pollute the global namespace and conflict, what trade-offs do I make when I choose to "isolate" one?

For instance:

I use two gems that pollute the global namespace: pry and gli , so I can no longer accommodate binding.prymore than I want.

One solution is to wrap the entire cli in the module:

module Wrapper
  include GLI::App

  extend self
  program_desc "..."
  ...

  exit run ARGV
end

binding.pry , .

?
, " "? " GLI::App"?

+4
1

Ruby , , , , . , .

module , , , . , , .

include - . , . , - , , .

+1

Source: https://habr.com/ru/post/1665397/


All Articles