logoalt Hacker News

pronyesterday at 2:18 PM2 repliesview on HN

First, Zig is more modern than any of the languages you mention. Second, I'm not aware that any of those languages offer arenas similar in their power and utility to Zig's while offering UAF-freedom at the same time. Note that "type-safe" arenas are neither as powerful as general purpose arenas nor fully offer UAF-freedom. I could be wrong (and if I am, I'd really love to see an arena that's both general and safe), but I believe that in all these languages you must compromise on either safety or the power of the arena (or both).


Replies

metaltyphoonyesterday at 2:37 PM

> First, Zig is more modern than any of the languages you mention

How so? This feels like an empty statement at best.

show 1 reply
pjmlpyesterday at 4:20 PM

Not really modern, it is Object Pascal/Modula-2 repackaged in C like syntax.

The only thing relatively modern would be compile time execution, if we forget about how long some languages have had reader macros, or similar capabilities like D's compile time metaprogramming.

Also it is the wrong direction when the whole industry is moving into integrity by default on cyber security legislation.

There are several examples around of doing arenas in said languages.

https://dlang.org/phobos/std_experimental_allocator.html

You can write your own approach with the low level primitives from Swift, or ping back into the trusty NSAutoreleasePool.

One example for C#, https://github.com/Enichan/Arenas

show 1 reply