Hacker News new | ask | show | jobs
by nextaccountic 1757 days ago
Hello, are you the language author? I've a question, the page says

> Safe

> Nelua tries to be safe by default for the user by minimizing undefined behavior and doing both compile-time checks and runtime checks.

And

> Optional GC

> Nelua uses a garbage collector by default, but it is completely optional and can be replaced by manual memory management for predictable runtime performance and for use in real-time applications, such as game engines and operational systems.

But of course, if one prefers manual memory management, then the code will be unsafe, right? Because use-after-free might occur.

(More specifically, free() is always unsafe in every low level lang, unless you have some static checking like Rust's borrow checker or ZZ and ATS compile-time proofs, which I think nelua doesn't have.)

1 comments

You are correct, when not using the GC and doing manual memory management the code will be unsafe as similar as in C, but the language generate some runtime checks (that can be disabled) to minimize undefined behavior. Nelua does not provide safety semantics like Rust because this increases the language complexity a lot, thus out of the goals. Nelua is not another safe language, and the compiler will not stand in your way when doing unsafe things, the user can do unsafe things like in C.
Okay, thanks! And props for making a simple language.