4 ms·
Nim would be really competitive in the gamedev/graphics field if there was a standard library that you can use without the GC. (Technically you can turn off the
by lasagnaphil 7y ago
Nim would be really competitive in the gamedev/graphics field if there was a standard library that you can use without the GC. (Technically you can turn off the GC entirely, but you can’t use the current standard library without it.) The language’s especially good for gamedev because of its extensive metaprogramming facilities, a sane build system (which lets you write build scripts with a subset of Nim itself), and the fact that you can load C/C++ libraries with ease.
- glouwbug 7y agoDon't forget, there's an LTO switch built right into the Nim build system which does whole program optimization across C translation units. This is the real killer feature - 40 years of GCC optimization leverage
- pjmlp 7y agoUnreal and Unity appear to be quite competitive with GC. I love Tim Sweeney quotes: "Programming languages without garbage collection send us down a long path of design decisions that lead to slow compile times and fragile runtime performance cliffs." https://twitter.com/timsweeneyepic/status/1223670431095427072 https://twitter.com/timsweeneyepic/status/122367043109542707... "It's interesting that many games can afford a constant 10x interpretation overhead for scripts, but not a spikey 1% for garbage collection." https://twitter.com/timsweeneyepic/status/880607734588211200 https://twitter.com/timsweeneyepic/status/880607734588211200
- jstimpfle 7y agoExcept, especially regarding the former tweet, I get the impression that he's having a pipe dream (with all respect), and he's heavily criticized. Did he actually program anything serious recently? He seems to be mostly tweeting about languages instead of actual technology. Honestly I can't make sense of what he's saying there, so there's a chance I'm not getting an important detail, but GC has nothing to do with function specialization. What does the following even mean? > Without garbage collection, offering an array of bytes where an array of integers is required requires stack-allocating an array of integers and converting each byte to an integer every time a subtype is used in place of an actual type. This is so absurd that it’s not done. The only interpretation of this that I can come up with would be just factually wrong.
- pjmlp 7y agoExcept that ignores the small detail that his company is selling a game engine with heavy use of GC, via Blueprints and C++ classes marked as UOBJECT. I bet he understands one or two things about shipping games with such engine. The sense I get from those tweets are the usual anti-GC discussions, mostly by folks that usually are even against modern C++ (as recently seen on some C++20 related discussions), which eventually derailed the discussion into something else.
- jstimpfle 7y ago> Except that ignores the small detail that his company is selling a game engine with heavy use of GC, via Blueprints and C++ classes marked as UOBJECT. Yes I've heard that there are some high-level things and _some_ amount of GC in there. And I'd wager that this is about where your knowledge about UE ends as well. If that is so, better don't make bold statements like "heavy use of GC". And Mr. Sweeny is obviously not only accomplished, but extremely sharp. But being sharp doesn't protect anybody from buying into stupid ideologies without any actual real world validation. Just as it doesn't protect HN trolls from collecting little factual nuggets from the internet and then spreading misinterpretations (i.e. falsehoods) hundreds of times. For example, the kind of "Data oriented design" that has been all the rage recently is so definitely no concession to OOP. Regarding Mr. Sweeney, the German Wikipedia page for example states that he didn't have any significant programming involvement anymore since Unreal Engine 3 (which was released in ~2006; Unreal Engine 2 was released in ~2002). Regarding programming, all I've read from him on twitter was just language related stuff, frequently mentioning theoretical blah-blah, such as covariance, monads, higher-kinded, blah-blah, and oh it is sooo practically relevant that C function pointer syntax is unusable if you want to return pointers to functions that return pointers to functions that return pointers to functions... > The sense I get from those tweets are the usual anti-GC discussions I suggest trying to make sense of his actual statements in the first place. Any offering from your side is very welcome! Again, I'll collect all the arrogance that I have in me, to criticize this man, who is obviously much sharper than myself, of blathering in this tweet a load of BS that hasn't undergone real world validation. Again, I might be missing the valid interpretation of what he's saying, but to me all evidence points to him needing a little refresher regarding the real world, in practice.
- beagle3 7y agoThe devel branch (which is actually usable, though not production ready yet) has a new gc (--gc:arc) which relies on reference counting, and is deterministic -- and the way it progresses, I suspect it will likely become the default at some point in the future. But even now, Nim's native GC has a deadline scheduler, which means that unlike e.g. Java or C# last I checked, you can tell it "ok, you have 2ms, collect as much as you can" - which is perfect for games. (It also has Boehm if you want it, and a couple more). And C# (though Unity and independently) is already competitive for games. So really, that's no reason not to use Nim today for games (or any other usse for that matter).
- gameswithgo 7y agoMany Unity games suffer because of that GC, and or developers suffer working around it. It isn't always a great story.
- pjmlp 7y agoMostly because many Unity developers are just indies learning C# and Unity at the same time and are yet to grasp how to do value type oriented programming.