"rolo" <rohitlodha / hotwireindia.com> wrote in message news:<ACEPLIKLBKEMDDIELPKICEBNCFAA.rohitlodha / hotwireindia.com>...
> Hi all
> 
> The ruby currently deals with only ints with one bit to differentiate it
> with object pointers. I am not sure how much improvements can be made in
> terms of speed if we deal all the primitives but I think that can be
> substantial for mathematical programs.
> 
> 
> Not holding minds on implementation problems in Ruby, does any one has ideas
> on possible ways to deal with all the primitives like floats etc in a
> dynamic language?

In general, compile-time type knowledge is mutually exclusive with the
kind of dynamic typing ruby provides.  But we can write critical
functions via:

(1) RubyInline http://www.zenspider.com/ZSS/Products/RubyInline/
(2) a C extension.
(3) a shared library (using ruby/dl to call lib functions from ruby)

Look at it this way: if you are doing serious number crunching, for
example, do you really want to be using a dynamic language for that
task in the first place?

The good news is that (1), (2), and (3) are all rather simple to do.
C extensions in ruby are surprisingly easy due to the gc and uniform
treatment of types (e.g. compare with python's C API or perl XS).

So to finally answer your question -- adding compile-time type
optimizations and/or other immediate values to ruby seems unnecessary
to me, given the ease of (1)-(3).  You may get significant speedup,
but native code is much faster.  And if you were really looking for
speedup, you would probably do one of (1)-(3) anyway.