Re:Crystal Programming Language
by db65edfc7996 on Thursday September 01, 2022 @09:40PM
(#32685635)
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).
[ Parent
| on HN ]
Re:Crystal Programming Language
by cultofmetatron on Thursday September 01, 2022 @10:00PM
(#32685745)
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...
Everything has a runtime nowadays. Even C, even if it isn't all that large (including for example the memory structures necessary to keep malloc and free working).
I think that’s too expansive of a definition of “runtime.” The context required by C and Rust programs is generally internal, meaning that interacting with the dynamic allocator doesn’t require the programmer to be aware of the implementation’s invariants. This is in contrast to a managed language like Java, where using a managed object from C via JNI requires coordination with the runtime (which in turn preserves the invariants).
But you have to know that as well for C - there are for example several Linux system calls you really should not call manually because that would fuck up the internal state in LibC. Yes, the runtime is really small, comparatively speaking, but it is still a runtime.
Which system calls are you thinking of? The only ones that I can think of would be brk(2) and sbrk(2), but any recent libc should be resilient to calls to those.
That being said, I'll grant that the distinction between "tiny runtime" and "no runtime" isn't useful and that C can be said to have a runtime insofar as most systems provide a `crt0` or equivalent.
Re:Crystal Programming Language
by heynowheynow on Friday September 02, 2022 @06:44AM
(#32689091)
Pony does stricter sharing semantics than Rust (multicore) with actors and allegedly one of the fastest GCs ever developed. Its community is even smaller than Crystal's. Pony was developed essentially as a PoC to demonstrate the GC.
Re:Crystal Programming Language
by hahaitsfunny on Thursday September 01, 2022 @11:07PM
(#32686138)
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
Windows support is close. See this issue:
Re:Crystal Programming Language
by db65edfc7996 on Friday September 02, 2022 @08:07PM
(#32697165)
Windows support has been a target since 2013. That's too long for me to put any credibility in projections on when it will be generally released.
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.