Live data from Hacker News

The feature in OxCaml that more languages should steal

theconsensus.dev

11–12 of 12 posts

Re: The feature in OxCaml that more languages should steal

#11
post #6

Earlier quoted context omitted.

could you clarify for me, because isn't that a different guarantee? from my understanding, Rust and Zig make allocations explicit, but [@zero_alloc] lets you declare "this function (and everything it calls) must not allocate" and have compiler enforce it.

If you don't pass an allocator param in Zig, then the function basically can't allocate.

No, that's just a convention. Any function can just create a new allocator, or import the global one, or use malloc from libc. Zig does nothing to enforce this convention.

Re: The feature in OxCaml that more languages should steal

#12
post #6

Earlier quoted context omitted.

could you clarify for me, because isn't that a different guarantee? from my understanding, Rust and Zig make allocations explicit, but [@zero_alloc] lets you declare "this function (and everything it calls) must not allocate" and have compiler enforce it.

If you don't pass an allocator param in Zig, then the function basically can't allocate.

isn't that more of a convention than an actual guarantee?
Post reply on HN