From: Wilbert Berendsen Date: 2003-01-27T01:04:52+09:00 Subject: Re: cascading configuration variables -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 26 January 2003 16:44, nobu.nokada@softhome.net wrote: > Hi, > > At Mon, 27 Jan 2003 00:15:38 +0900, > > Wilbert Berendsen wrote: > > I would like the variables with their values to be accessible as > > constants, because I think that is faster than hash lookups, and it looks > > elegant, because they will get referenced often from other script > > snippets that get loaded after the config is read. > > Retrieving a constant needs to traverse the ancestors of that > module, it isn't always faster than hash access. I agree it > looks simple/elegant. A question about that traversal to the ancestors of a module: is it possible to exclude ('mixout') a module again? e.g.: include Modulename # now stuff like constants is available exclude Modulename # now not anymore. Also: when do like this: module Bla m=Module.new m.const_set "ALSA", true include m end Bla.module_eval "ALSA" >>> true Bla.module_eval "m=nil; GC.start" Bla.module_eval "ALSA" >>> true so it seems the ALSA constant is still there; you can't remove modules it seems. > (... re include load) Yes, I read it. It would be nice and in the spirit of Ruby if it did! So after all I think constants look nice, but hashes may be the best way to go. bye, Wilbert - -- Wilbert Berendsen (http://www.xs4all.nl/~wbsoft/) To understand recursion, one must first understand recursion. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+NAavx+vk367Vl7wRAtZyAJwPHGgi9grCyHbsy79//f/hRXGCIwCfWBHT PBxcFNY320z33/bfLSwsNvY= =e7xP -----END PGP SIGNATURE-----