top | item 21884443

(no title)

nicholaides | 6 years ago

I wrote some Crystal recently for a hobby project. I have to say, I really like it.

• Nice syntax (mostly just that blocks/procs are easy to use— Ruby-like syntax is nice, but it’s not really that important)

• straight-forward class/object model

• type system is simple but powerful (union types + type inference are a great combo)

• syntax and std lib that enables functional-style programming, but isn’t strictly functional

• Pretty darn fast— compiles to machine code via LLVM, and seems like it’s not far behind C, C++ and Rust in most benchmarks, despite being garbage collected

What other languages offer a similar profile? D? Swift? Kotlin (via LLVM)?

discuss

order

eigenspace|6 years ago

> What other languages offer a similar profile? D? Swift? Kotlin (via LLVM)?

Julia. It’s fast, JIT compiled (static compilation is possible but it’s quite rough around the edges), has a fantastic type system, uses multiple dispatch to achieve some very cool stuff, has quite powerful lispy macros, and a really great community / library ecosystem, especially in scientific computing.

ziotom78|6 years ago

I'm an enthusiastic user of Julia, but I would not think of it as a language with a "similar profile" as Nim or Crystal. As you said, it's hard to produce static binaries, and they are huge if compared with Nim's or Crystal's. Moreover, the typical workflow for writing code is very different from what users of static languages follow (edit, compile, run, loop over).

smt88|6 years ago

F#. I hate the syntax, but anyone who enjoys ML will like it. Curly braces are optional.

It also meets all of your other requirements, including the "isn't strictly functional" part (which is somewhat rare).

Scala has most of these qualities, but people say it's extremely complicated and supports too many different paradigms in a single language. I've never used it.

Barrin92|6 years ago

I'd second F# and also in the same vein recommend Ocaml, in particular, if fast-running native code is a requirement. I haven't benchmarked it enough but I suspect that in most cases Ocaml might be a good deal faster.

I'm also very sympathetic to the non-functional aspects. I think being able to write imperative code easily (and it's surprisingly pleasant in ocaml/f#) is a huge plus.

3fe9a03ccd14ca5|6 years ago

> Curly braces are optional.

Why do languages make anything optional? It just leads to confusion and unnecessary style friction. I'm not saying everything should be as strict as Go, but... well, nothing should be optional.

agumonkey|6 years ago

Does F# offers native builds ? I thought it was CLR only.

Also Scala is about to jump to a new compiler (and maybe a new language). It's a weird time for scala (from the few that I know).

dom96|6 years ago

> What other languages offer a similar profile? D? Swift? Kotlin (via LLVM)?

Nim? :)

zem|6 years ago

d and ocaml are both nice. i like ocaml's syntax, but if you don't there is always reasonml, an alternate syntax that is a bit more c-like.

lmm|6 years ago

OCaml. Sometimes I feel like the last 20 years of language development have mostly been spent on catching up to OCaml.

agumonkey|6 years ago

Anybody toyed with crystal onto rpi or even microcontrollers ?

sansnomme|6 years ago

Not a lot of options if you don't want curly braces.

k__|6 years ago

Clojure, Haskell, Nim, Python, and I think you could even write JavaScript without using curly braces.