What are the main differences between Ruby and Crystal? [closed]

3

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

Examples:

  • Which is faster and lighter in processing?
  • Can everything done in Ruby be made in Crystal? Can I still use both simultaneously?
  • Which uses less code?
  • Which is easier to maintain?
  • What are the limitations of each?
  • What does one do better than the other?
asked by anonymous 24.08.2017 / 13:25

1 answer

7
  

What is the fastest and lightest in processing?

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

  

Everything that is done in Ruby can be done in Crystal, can I still use both simultaneously?

You can do everything, after 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 one uses less code?

I would need a better definition of what this is, but if it has fewer characters in the source I do not know for sure, I think Ruby, and it does not matter either, this is not relevant.

  

What is the easiest maintenance?

This depends on the programmer, not the language. It depends a little on taste, some say that static typing is easier, some say otherwise.

  

What are the limitations of each?

The main thing is that Ruby needs the virtual machine to run the default implementation, and Crystal does not, it's native. Crystal works with basically static typing and Ruby is dynamic. Ruby does not interact so well with C, has more competition difficulties and does not have a sophisticated macro system. It seems to me that currently Crystal's GC is worse than most Ruby implementations.

  

What does one do 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.

    
24.08.2017 / 14:19