On Tue, Oct 27, 2009 at 5:13 PM, Bill Kelly <billk / cts.com> wrote:
> Wow! That Fibonacci example on
> http://kenai.com/projects/duby/pages/DubySamples
> is really neat, especially the return value inferencing.
> I would love it if ruby had something baked-in to the language that was
> so unobtrusive, so much like writing regular ruby, but which could compile
> to fast static code.
>
> I've wondered to what degree such a thing might be possible, but I
> never realized it could really mirror regular ruby that closely. Very cool.

I'm very interested in adding optional static typing to JRuby, for
people that need it. Duby is, in a way, research into how this can be
done without damaging Ruby's syntax substantially. I think the
trade-offs so far in Duby are acceptable.

Granted, some people will want to lynch me for even suggesting the
idea. But when you need static types, or the performance that can come
more easily from static types, it's nice to have without dropping to C
or Java. So it's worth exploring for Ruby, and JRuby is the Ruby I
know how to hack.

> Is your system able to compile floating point operations down to
> primitives the way it does with fixnums?

Yes, check the bench_fractal.duby benchmark in examples/. It's mostly
the same code as the Ruby version, but runs almost two OOM faster.
Heavy floating-point math.

And I should make it clear....Duby is not a "statically typed Ruby".
It's a different language that co-opts Ruby's syntax and adds static
types and uses Java/JVM type system (though other backends are
possible).

- Charlie