News for hackers. Stuff that matters.
Re:The Odin Programming Language by Cyph0n on Friday January 31, 2020 @04:28PM (#22205969)
Jai has no GC though, which is critical in game dev.
Re:The Odin Programming Language by shakna on Friday January 31, 2020 @07:20PM (#22207417)

    nimc --gc:none
Nim has 5 GCs to choose from, as well as being able to have none at all.
Re:The Odin Programming Language by jug on Saturday February 01, 2020 @03:17AM (#22209405)
The GC can also run incrementally to meet deadlines. It’s not like a Java GC. It has been used in microcontrollers. People should probably learn more about it before shooting it down based on the word GC.
Re:The Odin Programming Language by pjmlp on Saturday February 01, 2020 @02:48PM (#22212770)
Java GC also has been used in microcontrollers, with soft real time deadlines, there are plenty of JVM vendors out there, including a couple that are only focused on embedded development like PTC, Aicas, Gemalto, microEJ, Virtenio.
Re:The Odin Programming Language by Cyph0n on Friday January 31, 2020 @09:00PM (#22208024)
That’s great, but can you use the Nim stdlib with no GC?
Re:The Odin Programming Language by beagle3 on Saturday February 01, 2020 @03:52AM (#22209511)
Yes, with some relatively minor caveats, mostly having to release memory yourself.

Also, the arc/orc GC is shaping up and already allows you to use exclusively reference counted memory management - so, efficient and perfectly deterministic timing but still get automatic memory management. (As usual, if you introduce cycles, it becomes more complicated)

And the Nim compiler elides many ref/unref ops, as well as keeping objects thread-local, so most performance objections to ref counting don’t actually apply. (.... and you have a choice of other automatic GC modes, including “none”)

Re:The Odin Programming Language by Cyph0n on Saturday February 01, 2020 @12:46PM (#22211854)
Good to know. Thanks for the explanation.
Re:The Odin Programming Language by shakna on Saturday February 01, 2020 @03:31AM (#22209453)
Yes, but you'll need to call dealloc [0] on the result of any call, unless you want to leak memory.

[0] https://nim-lang.org/docs/system.html#dealloc%2Cpointer

Re:The Odin Programming Language by renox on Saturday February 01, 2020 @04:31AM (#22209626)
And D has the DasBetterC mode, but I'm not sure that's good enough: when the language has a GC by default, all the libraries use it, the APIs relies on it..

What good is a language if you can't (easily) use its libraries?

Re:The Odin Programming Language by beagle3 on Saturday February 01, 2020 @04:45AM (#22209664)
Nim’s relationship with GC is very different than any other language that I’ve used.

It has very different selectable GC systems - Boehm, Bacon/Dingle, reference counting, or real-time deadline mark-and-sweep, and “none”. Perhaps I forgot one. Some libraries rely on a specific GC behavior but most work with any (with the caveat that “none” requires you to manually deal with garbage).

Nim’s mark-and-sweep is suitable for embedded systems and games, unlike Java’s, and so is the ref counting one; but even if none of the GCs work for you, the fact that there’s many of them and they are mostly interchangeable means that the dependency on them is much, much weaker than you are used to (although it still exists)

Re:The Odin Programming Language by pjmlp on Saturday February 01, 2020 @02:50PM (#22212777)
Just like Java actually, each implementation has its own set of algorithms including none.
Re:The Odin Programming Language by nimmer on Tuesday February 04, 2020 @12:43PM (#22238517)
You can use Nim in games using deterministic, real-time GC. Also, the new ARC memory management will replace GC https://forum.nim-lang.org/t/5734