What are the main differences between Ruby and Crystal?

Asked

Viewed 296 times

5

I saw some information about the Crystal language a few days ago, but I would like to understand a little better what the main differences with Ruby.

Examples:

  • Which is faster and lighter in processing?
  • Can everything done in Ruby be done in Crystal? Can I still use both simultaneously?
  • Which uses the least code?
  • Which has easier maintenance?
  • What are the limitations of each?
  • What one does better than the other?

1 answer

8


Which is the fastest and lightest in processing?

Languages do not usually have this characteristic in a striking way. It depends on the algorithm, the code done, etc. But by the way each one works Crystal tends to be faster.

Everything done in Ruby can be done in Crystal, I can still use both at the same time?

You can do everything, after all, all programming languages can do everything. But they are not compatible. There are similarities between them more than other languages, but they were not meant to be complementary.

Which uses the least code?

I would need a better definition of what this is, but if there are fewer characters in the font I don’t know for sure, I think Ruby, and it doesn’t matter either, this isn’t relevant.

Which is the easiest maintenance?

This depends on the programmer and not the language. It depends on a little taste, there are those who claim that static typing is easier, there are those who say the opposite.

What are the limitations of each?

The main ones are that Ruby needs virtual machine to run the standard implementation and Crystal is not native. Crystal works with basically static typing and Ruby is dynamic. Ruby does not interact as well with C, has more competition difficulties, and does not have a sophisticated macros system. It seems to me that currently Crystal GC is worse than most Ruby implementations.

What one does better than the other?

This is opinion and depends on what you want. The fact is that Ruby has a solid community, Crystal does not. Crystal should be more robust because of typing.

  • +1 It depends on the programmer and not the language... Always has been and always will be

  • #Uzumakiartanis yes no doubt ends up without an almost unanswered question possible will always depend on the programmer

  • "Which allows you to express more in fewer lines of code" not a relevant question? I thought it was. I think that’s what the AP wanted to know.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.