Comment

Comment by gpanders

>Rust also hates hidden allocations

Does it? Rust seems happy to allocate silently all the time.

    let x = String::new(“hi”);
    let y = vec![];
Do either of these allocate? As the writer or reader of this code, how do I know if either of these statements result in a heap allocation, or if the data is strictly on the stack?

Zig’s requirement of explicitly passing around an Allocator type removes any ambiguity completely.

parent gpanders 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton