On 4/8/15 4:59 AM, Jacob Carlborg wrote:
On 2015-04-07 19:46, Ary Borenszweig wrote:

It's true that Ruby is slow, but only because their priority is
correctness.

I don't think it's so much about the correctness, it's rather the
complicated features it supports, like metaprogramming. eval and
bindings are causing problems, also promoting Fixnum to Bignum when it
doesn't fit is a problem.

The autopromotion of Fixnum to Bignum is interesting. It always leads to correct code, although it's slow.

Without this feature you start to realize how week are other languages. For example, take the simple problem of parsing a number out of a string. In Ruby it's:

"123".to_i #=> 123

But this also works:

"12398123091823091823091823091823091820318203123".to_i #=> 12398123091823091823091823091823091820318203123

In typed language one would be forced to make a decision for the return type of to_i. Maybe if it doesn't fit in an Int32 or Int64 raise an exception or signal an error somehow. In Ruby you just forget about these little problems, it will always work and give the correct result.

That's one of the reasons I think it's bad to say that Ruby is not a "correct" language.

Reply via email to