5 ms·
dlang would have been a very serious contender to C++ had it been fully nogc, stable & lean. Also dlang unnecessarily suffered low adoption in start due to comp
by kinjalkishor 4y ago
dlang would have been a very serious contender to C++ had it been fully nogc, stable & lean. Also dlang unnecessarily suffered low adoption in start due to competing stdlibs, trying to be both Java & C++ at once.
- kinjalkishor 4y agoI am still a big fan of both dlang & pascal & very hopeful of dlang's Bright future ahead.
- vintagedave 4y ago+1 to Pascal here! Underrated language.
- WalterBright 4y agoIf you use the @nogc attribute, D is fully nogc.
- kinjalkishor 4y agoYes it is very useful addition. Hopefully stdlib will also be fully nogc soon. Of all available options I am most hopeful of dlang. While it doesn't still have taken off it still is improving a lot & has high chances of increased usage. (Python also took years).
- WalterBright 4y agoIt doesn't need to be fully nogc. Not using the parts that use the gc will cripple nothing. You'll know which ones use the gc because they won't compile with @nogc.
- dymk 4y ago@nogc is fine, if you're okay with not being able to use large swaths of the standard library, and by extension, most popular D libraries.
- WalterBright 4y agoNot much of the library is dependent on the GC. For example, only one of the algorithms is.
- skl131313 4y agoThere's no "nogc" containers in phobos, or allocators, or an idiomatic way to do safe manual memory management. It expects you to do it the C way. It's also impossible to implement some things because of how D does moving. There's a DIP in the works to change how moving works, but it's overly complicated and bound to introduce even more bugs. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1040.md https://github.com/dlang/DIPs/blob/master/DIPs/DIP1040.md
- kinjalkishor 4y agoYes I use @nogc on main itself, to catch all gc usage.
- mhh__ 4y agoMost C++ codebases would be exactly the same with or without a GC. Probably 90% of collective programmer-intuition about memory allocation is either completely wrong or from thinking about a scaling to a point that most products don't get anywhere near.
- dymk 4y agoProbably not, or they'd just be written in Java.
- mhh__ 4y agoThere is more to performance than allocating memory. In fact some very performance-centric codebases do use a GC like unreal engine. On the subject of games it always makes me chuckle when I see people complaining about garbage collection but then having 20 calls to malloc in their hot loop. All memory allocation is slow and not necessarily bounded. I have written code that uses SoA, cache aware metaprogramming, inline asm, SIMD etc, with a GC because I knew I didn't need to allocate often. On the subject of Java, I'm no fan of it but lots of projects would probably be fine - probably not quite as fast, but not horrifically so. On hackernews we only discuss extremely careful or expertly written code whereas in real life a lot people use C++ because it's what they got hammered into them at university 20 years ago as the fast language. For example a lot of engineering and finance codebases are written in a very bad style of C++ code that would be improved by not having the programmers worry about memory too much - infrastructural code is more subtle, but most code serves a direct purpose like implementing some model. In these cases memory allocation is merely a means to an end rather than part of some grand strategy (i.e. it's not like writing a library)
- dataangel 4y agoUnreal Engine mostly uses GC for game world objects. Only C++ classes that inherit from a special base class and opt-in are subject to GC. If they used GC for everything the performance would be much worse.
- 4y ago