Joka/Parin update - Optional GC support
Kapendev
alexandroskapretsos at gmail.com
Fri Jun 20 19:23:57 UTC 2025
[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

More information about the Digitalmars-d-announce
mailing list