SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Thursday, February 11, 2010

Syntax of require/load vs. syntax of include

While writing ruby scripts we may have notice that when we use require or load, we use quotation marks for requiring or loading the name of the item.But when we use include we won't do this.

Because require and load take strings as their arguments, whereas include takes the name of a module, in the form of a constant.More fundamentally it's because require and load are locating and loading disk files, whereas include is performing a program-space, in memory operation that has nothing to do with files.It's a common sequence to require a feature and then include a module that the featur defines.The two operations thus often group together, but they are completely different from each other.

No comments :

Post a Comment