News for hackers. Stuff that matters.
Re:Crystal Language That Aims at C Performance with Ruby Syn... by ducktective on Friday April 02, 2021 @02:41PM (#26674475)
Is there a possibility that Crystal could be used on MCUs? What would be its advantages over Micropython, C/C++/Rust or Zig?
Re:Crystal Language That Aims at C Performance with Ruby Syn... by adenozine on Friday April 02, 2021 @03:08PM (#26674815)
Crystal has a GC, and also compiles to LLVM IR, so it's a little heavier than what you might want for MCUs. Circuitpython, C-*, Zig, Nim and other co would all be more appropriate choices, generally speaking.

I'd love to see some effort taken to bring Crystal lower and closer to metal but I don't think there's that much desire in the community for it, and there's not enough corp resources to just throw man-hours at whatever the community wants right now. Manas seems to have a little trouble keeping people around the Crystal core team, though I'm not exactly sure why.

It'd be great to have a Crystal that could spit out C or Zig code instead of LLVM IR. That'd be awesome.

Re:Crystal Language That Aims at C Performance with Ruby Syn... by ultrarunner on Friday April 02, 2021 @03:18PM (#26674934)
The discussion I've seen surrounding this from core maintainers is that embedded Crystal is not a (medium-term, at least) goal. While you can technically turn off the garbage collector, it's not currently a practical solution.
Re:Crystal Language That Aims at C Performance with Ruby Syn... by tyingq on Friday April 02, 2021 @02:46PM (#26674545)
Nim seems like it would do well, since you can just compile to C code.
Re:Crystal Language That Aims at C Performance with Ruby Syn... by mhh__ on Friday April 02, 2021 @03:15PM (#26674899)
Nearly all languages worth considering can compile to either GCC or LLVM one way or the other, the thing I find that makes the difference for microcontroller use now is (to be worth using over C) the ability to abstract over the peripherals quickly (There is a project that I think parses the peripheral datasheet at compile time in D, even), preferably zero cost.