The Crystal Programming Language Forum

So far I really like Crystal

Hi, I’m studying crystal currently and I really like it.

During the last couple of years, I studied : C++, Python Go, Nim, Rust, V-lang, Swift, TypeScript, JS and other languages.

I was looking for a a language which combines a least the following features:

  • Statically typed.

  • compiled.

  • having “greenlets” or coroutines (plus channels), i.e. CSP.

  • concise.

  • small.

  • fast (efficient).

  • implementing some basic kind of classes or OO or structs + method.

  • Good readability.

  • C++ fits none of those boxes (except speed -if done right-).

  • Go is small, fast and simple, but I find its syntax a bit verbose, subjectively.

  • Nim is concise and fast, but surprisingly complex and not really a small language.

  • Rust is fast, but not small, not simple, and relatively verbose.

  • After a couple of years of studying all those languages, my favorite, is now Crystal : it ticks all the boxes, as far as I am concerned.

  • Last, but not least, IMHO, the absence of visible bloc delimiters in Python and Nim are a recipe for disaster (the copy paste operations soon of later always go wrong).

My motto : “Complex problems require simple languages”.

The availability of librairies for linear algebra and NLP are a plus for my personal projects.

If I I had to mention a feature I would like to see implemented the future, I would mention the option to compile an app into web assembly (wasm).

I’m grateful to the creators of Crystal.

24 Likes

Try Kotlin! Seriously.
It is compelling as a general programming language and seems to check all your boxes too, but the real-world practicality depends.

No language will beat Python at data-related projects anytime soon.
Same for Rust, it will never replace C entirely; your microwave oven won’t run with Rust anytime soon.
And IMO, Ruby is the best at writing business logic. (As in writing enterprise use cases, not those big balls of mud people put in the ActiveRecord subclasses.) Not even Crystal can remotely do something comparable.

I’ll pick what I do first, then choose the language after.
It’s nice to be able to add Crystal to the toolbox, but the market decides what I do, so I won’t find myself using Crystal professionally anytime soon.

My $0.02

1 Like

Thanks. I ha forgotten that Kotlin seems to:

  1. Be portable.
  2. Have greenlets / channels (of sorts).

What disturbs me with Kotlin is that it’s built on top of Java.

1 Like

Java libraries are difficult to use as there’s no named parameters(keyword arguments) support so you have to use a dozen builder methods. For example, check the Twilio example code for various languages.
I would use C# instead of java based languages.

Union type and named parameters are must haves for compiled languages for me.

I have similar thoughts to you, except I find the Go code difficult to read.

Crystal has a few things that worry me - poor language servers/tooling (but admittedly it’s a simple language so I can manage without), slow compile time, still tiny community, not yet feature complete (Windows support, multithreading) - but using it has been a pure joy. It’s the language I’ve always wanted to have - cleaned up, compiled Ruby. It gives me the same feeling of excitement I had many years ago when I was writing my first programs.

WIth that, I also want to express my gratitude to the authors of Crystal :heart:

6 Likes

I a agree. I wouldn’t use Crystal at this stage for production, but I like to experiment with it.

Kotlin has a native compiler.

Thanks!

Is Kotlin able to spit out nice small fast executables like Crystal or Nim? :thinking:

What do you mean by the above – poor server-side development features? I keep hearing great things about Lucky, Amber & Kemal frameworks.

Or, are you referring to something else?

I don’t know: I have only studied Kotlin superficially and only in the context of Android apps development (based on Java ultimately).

I dropped it, because developing apps with Swing on Mac OS seemed infinitely easier for a lot of reasons than using Kotlin on Windows.

Language server is a piece of software that provides the underlying functionality to IDEs. I meant the code navigation, code completion etc. in IDEs and editors is not as good yet for Crystal as it is for other languages. It’s something that I believe will improve over time, but is impacting productivity in the short term.

I use « Crystalline » which works fine.

https://github.com/elbywan/crystalline

Not sure about the size of resulting executable. Was just providing answer that kotlin doesnt need to run on jvm.

Scala has scalanative as well, to compile to native, without having to sit on top of java.

https://scala-native.readthedocs.io/en/latest/

But if you want to use Java libraries, you are stuck to JVM I guess and can’t compile to native code, both for Kotline and Scala.

I do no longer use systems which relie on the JVM.

Im loving this lang so far. The readability and simplicity of Cr is the biggest selling point.

I come from Py background (w some Ruby), and its been a blast writing stuff in Cr, just absolute fun.

As for the limited # of libs, its expected, Py, C, CPP etc have been around for decades. I am already using Cr-written apps in production.

heres an example, needed some sort of a firewall port tester tool to spin up mass # of ports and test connectivity. Coudnt find anything out there that does this, wrote this in Cr in relatively short time.

Compared to CPP/C/Java etc, this would take me much longer due to syntax and more complex language idiosyncracies

2 Likes

It’s enthusiastic “in the field” usage comments like Perfecto’s, or Serge’s original post that will easily propel the masses to give Crystal a shot. I think the language’s readability is underrated & should be more emphasized. That’s why I’m looking to promote Crystal in East Africa with all the Python/dotNET/Java coders I know. This is one of my main goals for 2022 when I start my grassroots “Community Tech” rapid IT learning/training idea.

In addition, I would add that these short Crystal review posts should be shared everywhere – tweeted, Facebook, blog & YouTube comments, VK, etc.

1 Like

Agreed about not wanting to rely on the JVM. I remember I set up my friend’s Italian restaurant with the very popular open source uniCenta POS (which is written in Java & is a fork of the popular commercial Open Bravo POS from the dotCom boom).

Anywho, I installed it on a rugged 1GB RAM touch screen PosiFlex POS terminal with a Via NANO processor running Windows 7. The uniCenta dashboard with the table layout would sometimes be slow to update due to that damn JVM & the memory it was hogging.

It would be amazing to see how much better uniCenta would function if it were coded in Crystal with a good cross platform GUI framework. :thinking:

1 Like