Mailinglist Archive: yast-devel (53 mails)

< Previous Next >
Re: [yast-devel] Never include anything in global namespace
On Fri, 28 Feb 2014 16:02:04 +0100
Arvin Schnell <aschnell@xxxxxxx> wrote:

On Fri, Feb 28, 2014 at 03:41:14PM +0100, Josef Reidinger wrote:

I just would like to remind that noone should include/extend anything to
global namespace in his ruby code. It affects clients, modules, libs and
also includes. The most visible part is `include Yast` which cause that all
modules living in Yast namespace start living in global namespace and start
colliding with ruby classes and modules. But also other smaller modules can
cause problem.

Sadly Ruby uses the term include for something fundamentally
different to most other languages, most prominently C (and YCP).
No wonder mistakes like that happen.

Also see:

Thanks for links. I understand that it can be confusing, so I do not blame
anyone, I just want to point to it, so do not repeat such problem ( or less
often ).

"Oddly enough, Ruby's require is analogous to C's include, while
Ruby's include is almost nothing like C's include."

It is strange to compare object language to C. If I need to find something
similar it is like
"using" in C++. There is same rule for using "using" in header files, but of
course there is some differences.


"This can be confusing as the include verb is used very
differently in other languages."

Yes, it is often used as mixins, but it include everything from target module
so even nested classes and constants like it happen in this case. Usual use
case is e.g. Enumerable or Comparable mixin.


To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation