Rust or Crystal (for a rewrite of my experimental search engine)?

I’m hesitating between Rust and Crystal for a rewrite of a prototype search engine I wrote a few years ago initially in Python, then Vala and then later in Golang.

I’m tempting to use Crystal because of it’s apparent simplicity, conciseness and expressivity (and good performance).

I was also tempted to use Nim, but I don’t like the absence of visible delimiters in languages such as Python or Nim; I regard that feature as a source of errors (e.g. in copy/paste operations).

However, I would like to ask the Rust experts if, to their knowledge, I might miss something essential by using Crystal rather than Rust.

I just had a look at crystal, didn't know it before. It seems quite nice to me.

I like that there is no implicit null and the inferred static types. These are also the things I love most about Rust. There is some sweet ruby class stuff in crystal, but I have made fantastic experiences with the trait system from Rust and I prefer those over classes.

Have you used the trait-based type system yet? Might be a reason to choose Rust.

For me, traits are a refreshing alternative to the prominent Java-like object oriented type systems. This approach does not result in complex inheritance trees or diamond problems or hidden inherited properties.


Thank you!

One Crystal concept which comes close to Rust traits in Crystal (or Golang interfaces) is: Abstract classes :

abstract class Animal
  abstract def talk

class Dog < Animal
  def talk # You must implement talk

In the sense that all classes which implement the abstract methods defined in the abstract class Animal are also Animal(s).

Yes. If crystal has interfaces, this would come even more close to traits. In Rust, there is no other way, which results in a very clean architecture.
One special thing about traits is that you can implement a functionality for many types, including types from other libraries. This way, you can extend the existing standard library with your own functionality.


I think if the differences between languages are minor enough that braces can be the deciding factor, it really doesn't matter. Just pick whichever one sounds more interesting to you.

That said, this is of course the Rust users forum. I know Rust, and I don't know Crystal, but what I've seen of it suggests that it's mostly a combination of the "good parts" (as the designers define "good") of other popular programming languages. If you've already used languages that have classes, inheritance, garbage collection, static typing, non-null by default, and type inference, you're probably going to be pretty comfortable with it. Rust doesn't have classes or inheritance, does have traits and sum types, and uses ownership to manage resources including memory, so the experience of designing programs in Rust will probably be different from what you're familiar with if Python, Vala and Go are representative of your programming experience so far.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.