From: Overnight Date: 2002-09-05T07:45:35+09:00 Subject: Newbie Qs: startup time, Module.constants, chdir, Ruby distro's library Hello there! I'm new to Ruby and my first impressions are really good: after some experience with both Perl and Python, the clean OO-ness of Ruby has been exciting, not to talk about its "no surprises" approach. My first questions are of various kind, please apologize me for mixing them in a single message: 1) on my *monster* PC (a glorious 200mhz Pentium box with W98...), Ruby's startup time is about 1 second (e.g., ruby -e "p 'hello world'" takes 1 second) Isn't it too much? Using IRB is even worse: it takes about 2/3 seconds to show the first prompt, and about 0.5 seconds to process every line. Is this normal? Is it time for me to think to a Pentium II? :-) I'm using Ruby 1.6.7, installed from ruby-1.6.7-i586-mswin32.zip (sorry, I don't remember the exact version of the executable I downloaded, but it's the one which does not require Cygwin or other support environments) 2) after browsing the Pragmatic Programmer's Guide, I did some tests with Module.constants and Module#constants. Now I really don't understand the following: > module M > Konst1=1 > end > > M.constants ['Konst1'] > class C > Konst2=1 > end > > C.constants ["Konst2", "DATA", "FALSE", "ARGV", ...] Why the different behaviour? I mean, why #constants returns just a module's own constans, and a class' own *and* inherited constants? There is also the fact that: > M::DATA # > C::DATA # Since DATA is accessible through M (as well as all other consts), shouldn't M.constants include it (together with all other consts)? I've read about the C.constants-C.superclass.constants trick, my problem is not finding a way to discover C's own constants, I just would like to understand #constants has a different behaviour when it is applied to a module or a class. 2bis) To understand when Module.constants and Module#constants are called, I used: class Module alias oldc constants def constants puts "constants" oldc end class <