[Nitro] Build scripts as modules or plain scripts

gabriele renzi surrender_it at yahoo.it
Thu Jan 4 02:53:22 EST 2007


transfire at gmail.com ha scritto:

> Of course this effectively puts encapsulation, at least at the top
> level, on a per-file basis. But in many respects that seems kind of
> nice. It increases flexability and reduces configuration complexity.
> 
> So what do your think? Is this technique worth promoting? Or am I being
> silly and should just wrap all my scripts in modules?


first: adding the "as_foo" just adds useless complexity, imho, just load 
a module and include id when needed.

Then, if you just add

  and a directory is a module, too so that
   require 'foo'
  loads module Foo
  and
   require 'foo/bar'
  requires module Foo::Bar

and you have the python's import system, which is a very good thing imo 
and could reduce ruby's stdlib size of a 1/2% :)



-- 

blog en: http://www.riffraff.info
blog it: http://riffraff.blogsome.com
jabber : rff.rff at gmail dot com



More information about the Nitro-general mailing list