Live data from Hacker News

The Crystal Programming Language

crystal-lang.org

101–110 of 116 posts

Re: The Crystal Programming Language

#101

Out of all the programming languages coming out these days, Crystal is the one I am watching out for. I've never programmed with Ruby, but I have programmed with Python in the past so I really value the focus on programmer friendly syntax that Python taught me. Currently a Golang a programmer and I love the performance plus binary executables! From my experience so far Crystal feels like a performant language with th…

Just curious whether you have checked out Nim. I love it coming from Python, curious to know what Crystal offers apart from Nim for Python users.

Sorry haven't heard about it but thanks for bringing it to my attention!

Re: The Crystal Programming Language

#102
post #57

Now, all we need for crystal to succeed is numpy, scipy, something pandas-like, and of course matplotlib (not plots, matplotlib). By the way, how are we on data-science friendly IDEs? Debugging? Automatic thorough documentation generator? Tooling in general? Is the time to first plot fast? Where I work, we desperately need a fast python.

>... numpy, scipy, something pandas-like, and of course matplotlib... Where I work, we desperately need a fast python. It sounds like Julia would be a better fit than Crystal? Ironically they have similar problems: compile/start-up time (though crystal has working ahead of time compilation - AFAIK Julia developers are still working on speeding up "first run" in various ways).

At first I thought Julia could fill role, but it has many problems with correctness (bugs), proper documentation, tooling…

Re: The Crystal Programming Language

#103

Earlier quoted context omitted.

Nim and Crystal feel like they are in exactly the same space? GC, fast, single executable compilation without runtime (I would also throw Go into this list).

there is a runtime. its just baked into the final executable. you can't have garbage collection without one.

Nim's new ARC gc, which will be default soon-ish in 2.0, does not have a "runtime" as commonly understood.

It is fully deterministic, so it simply injects alloc/free calls in the generated code at compile time. It even has an option that can show you where the calls are injected.

https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc...

Re: The Crystal Programming Language

#104
post #88

Earlier quoted context omitted.

> 3. Obscure error messages (macros are to blame here) I feel like this is a bit strongly influenced by the macro experience. Macros are an advanced and powerful feature and naturally more complex to debug. In general, Crystal's error messages are often praised for their clarity and helpfulness (especially compared to dynamically typed languages, of course). > 4. Weak HTTP server implementation -- making things such…

> Windows support is pretty stable and almost complete by now. This isn't really a genuine statement. Currently Crystal Requires a full installation of Visual Studio on Windows: https://github.com/crystal-lang/crystal/issues/6170

Yes, for compile crystal program to windows binary, you need to install VS Build Tools.

But after the executable binary is compiled then it can run without any dependencies. I think the later is more important for a window program.

I gave the exes to my users and none of them had any problem running it.

For development currently WSL is still the best way to run crystal in windows.

Re: The Crystal Programming Language

#105

Earlier quoted context omitted.

Nim and Crystal feel like they are in exactly the same space? GC, fast, single executable compilation without runtime (I would also throw Go into this list).

You can ditch Nims GC and runtime and bring your own if you want. Of course you'd lose access to most of the stdlib but this is why Nim can be used and is popular for embedded / bare metal. Tmk Crystal still lacks Windows support as well and probably other os's / archs's compared to Nim

Crytal can disable GC and runtime too.

https://crystal-lang.org/reference/1.4/syntax_and_semantics/...

Of course, same as Nim, you lose access to most of the stdlib.

Re: The Crystal Programming Language

#107
post #104
post #88

Earlier quoted context omitted.

> Windows support is pretty stable and almost complete by now. This isn't really a genuine statement. Currently Crystal Requires a full installation of Visual Studio on Windows: https://github.com/crystal-lang/crystal/issues/6170

Yes, for compile crystal program to windows binary, you need to install VS Build Tools. But after the executable binary is compiled then it can run without any dependencies. I think the later is more important for a window program. I gave the exes to my users and none of them had any problem running it. For development currently WSL is still the best way to run crystal in windows.

> WSL is still the best way to run crystal in windows.

WSL is never the best way to do anything, unless the question is "what is the best way to emulate Linux on Windows?". In all other cases, WSL is literally the worst way to do anything.

Re: The Crystal Programming Language

#108
post #61

I'm a Ruby guy and I tried Crystal for about 2 years and absolutely loved it but then had to give up for the following reasons: 1. Too slow to compile (the whole program + the entire stdlib is built everytime you build!). No incremental compilation available. 2. No language server (apparently it's just impossible due to the way the language works). Tbh, I'd be happy with just "Go to definition" but alas, no-can-do! 3…

> 2. No language server (apparently it's just impossible due to the way the language works). Tbh, I'd be happy with just "Go to definition" but alas, no-can-do!

This works on Doom Emacs!

Re: The Crystal Programming Language

#109
post #58

Earlier quoted context omitted.

What about it makes you cringe?

This kind of thing End End End End End

While it is not completely impossible to end up (pun intended) with something like this, you usually follow a coding style that avoids it. Kind of like in Ruby.

You have the option to define named methods that yield or to use the short one-parameter syntax where this:

  method do |param|
    param.some_method
  end
becomes

  method &.some_method

Re: The Crystal Programming Language

#110
post #2

What is the edge it gives when compared to Rust, Zig, and Nim?

Rust doesn't have a garbage collector, meaning you have a steep learning curve around the borrow checker. Zig aims to be a C replacement, with manual memory management as well.

Nim is very close to Crystal. Some parts that might lead you to prefer Crystal however:

- Nim compiles to C code, meaning Nim is coupled to what C can do. I find compiling to C to be distasteful, C is not meant to be a compilation target. We should be getting away from C, IMO. Nim is limited to what C can achieve, and the design of the language trends towards "here's how this translates to C" as a result. Compiling to C is also an extra layer of abstraction, as now for instance with debugging you have to go through the C layer. Crystal like Rust uses LLVM

- Crystal also uses Ruby syntax, which many prefer. I have grown to dislike semantic whitespace such as how Python works, so this is a plus for me.

- Crystal has a garbage collector, period, and leans into that. Whereas Rust, Zig, and Nim want to give you complete control over memory, Crystal is more focused on being a better high-level programming language, competing with the likes of JVM/NET/Go/Ruby. This focus is likely Crystal's main edge. The only other single-executable opinionated GCed language is Go. Crystal's type system is much better than Go's. If Crystal can reduce compile times and capture some of Go's pragmatic aura, it will see more success.

Post reply on HN