www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Joka/Parin update - Optional GC support

reply Kapendev <alexandroskapretsos gmail.com> writes:
[Parin](https://github.com/Kapendev/parin) is a game 
engine/framework I'm working on and 
[Joka](https://github.com/Kapendev/joka) is a utility library 
used by Parin. Both don't use the GC by default.

I recently added a new version flag: `JokaGcMemory`. When 
defined, it changes the allocation strategy from manual memory 
management to using the GC. It basically disables the "free" 
functions and uses `new` for everything. So if you prefer 
GC-based code, it's now an option. Nothing changes unless you opt 
in. The idea for this came while reading some comments on a 
Discord server:

 yeah, people use D, but then go 'GC' is evil hurr durr
 nogc this nogc that
 like why
I personally don't hate GC. Manual stuff is just more fun for me and it makes it easier to run games on a web browser. GC + Kapendev = ❤️ (This line makes the post more professional) Anyway, the trickier part of adding this was working around the ` nogc` attribute. It wasn't too bad, but now ` nogc` effectively acts like a made up ` noallocation` attribute for my code, which is kind of nice. It would be easier to just ignore it, but I think it can be useful sometimes, so I do support it when I can. That's it. Nothing crazy, but it's a cool thing. Btw, check out my new game: https://kapendev.itch.io/worms-within ![game screenshot](https://img.itch.zone/aW1hZ2UvMzU4OTk2OC8yMTM5MTYyMC5wbmc=/original/fWBA1L.png)
Jun 20
parent reply Doigt <labog outlook.com> writes:
On Friday, 20 June 2025 at 19:23:57 UTC, Kapendev wrote:
 The idea for this came while reading some comments on a Discord 
 server:

 yeah, people use D, but then go 'GC' is evil hurr durr
 nogc this nogc that
 like why
I wonder who said that huh
Jun 28
next sibling parent reply xoxo <xororwr gmail.com> writes:
On Saturday, 28 June 2025 at 07:21:36 UTC, Doigt wrote:
 On Friday, 20 June 2025 at 19:23:57 UTC, Kapendev wrote:
 The idea for this came while reading some comments on a 
 Discord server:

 yeah, people use D, but then go 'GC' is evil hurr durr
 nogc this nogc that
 like why
I wonder who said that huh
Anyone working in the low latency/interactive field, including game developers, will tell you the same things: GCs are bad, you need to prepare ahead of time, and you should reuse your buffers and objects. Although there are many counter-examples that fully utilize the GC, it's generally minimized because the majority of the work is done in C, C++, or Rust. The general rule, which applies to both malloc and GC, is to avoid allocating unless absolutely required.
Jun 28
next sibling parent reply Doigt <labog outlook.com> writes:
On Saturday, 28 June 2025 at 09:16:22 UTC, xoxo wrote:
 On Saturday, 28 June 2025 at 07:21:36 UTC, Doigt wrote:
 On Friday, 20 June 2025 at 19:23:57 UTC, Kapendev wrote:
 The idea for this came while reading some comments on a 
 Discord server:

 yeah, people use D, but then go 'GC' is evil hurr durr
 nogc this nogc that
 like why
I wonder who said that huh
Anyone working in the low latency/interactive field, including game developers, will tell you the same things: GCs are bad, you need to prepare ahead of time, and you should reuse your buffers and objects.
Yeah no that's not happening. Maybe YOU are going to tell me that, but no, not just anyone. GC == Bad people are just extremists. Tell that to all the people making commercial games live near montreal where lots of video games companies operate and I know people who work for those companies... and they use I tell them about this silly little bacon dance the nogc folk are doing everyday in D land? I'll let you guess...
Jun 28
parent JN <666total wp.pl> writes:
On Saturday, 28 June 2025 at 12:32:38 UTC, Doigt wrote:
 On Friday, 20 June 2025 at 19:23:57 UTC, Kapendev wrote:
 The idea for this came while reading some comments on a 
 Discord server:

 yeah, people use D, but then go 'GC' is evil hurr durr
 nogc this nogc that
 like why
I wonder who said that huh
Well if you want to target the web you don't have access to D's GC anyway.
Jun 29
prev sibling parent Kapendev <alexandroskapretsos gmail.com> writes:
On Saturday, 28 June 2025 at 09:16:22 UTC, xoxo wrote:
 game developers, will tell you the same things: GCs are bad, 
 you need to prepare ahead of time, and you should reuse 
 your buffers and objects.
Would not say bad. Depends also on how much control you have over the GC. I think the D GC lets you disable and enable stuff at runtime?
 The general rule, which applies to both malloc and GC, is to 
 avoid allocating unless absolutely required.
Yep.
Jun 29
prev sibling parent Kapendev <alexandroskapretsos gmail.com> writes:
On Saturday, 28 June 2025 at 07:21:36 UTC, Doigt wrote:
 On Friday, 20 June 2025 at 19:23:57 UTC, Kapendev wrote:
 The idea for this came while reading some comments on a 
 Discord server:

 yeah, people use D, but then go 'GC' is evil hurr durr
 nogc this nogc that
 like why
I wonder who said that huh
It was... you. #exposed #drama #bignews
Jun 29