News for hackers. Stuff that matters.
Re:Austral Programming Language by solomatov on Thursday July 27, 2023 @09:53PM (#36902330)
> No destructors.

What's the logic behind this? It's nice to have a way to pair resource usage with disposal. Or does the linear type system allows not to forget about the resources which have to be closed.

Re:Austral Programming Language by ZoltanAK2 on Thursday July 27, 2023 @10:18PM (#36902491)
Indeed, the linear type systems makes sure that you won't forget to dispose of resources.

Linear types enable manual memory management without memory leaks, use-after-free, double free errors, garbage collection, or any runtime overhead in either time or space other than having an allocator available. More generally, it enables us to manage any resource (file handles, socket handles, etc.) that has a lifecycle without letting us forget to dispose of the resource (e.g. leaving a file handle open), dispose of it twice, or use it after disposal (e.g. reading from a closed socket), all without runtime overhead.

The Austral tutorial's chapter on linear types (https://austral-lang.org/tutorial/linear-types) explains how this works in a fairly clear way.

Re:Austral Programming Language by olodus on Thursday July 27, 2023 @10:16PM (#36902485)
Yes, the compiler will remind you if you haven't cleaned up a value of linear type.

The 'no destructor' rule follows the 'no hidden flow' design, similar to Zig. Some doesn't like it, but personally I prefer it.

Re:Austral Programming Language by solomatov on Friday July 28, 2023 @02:24PM (#36911075)
Yep, I agree with you that it's better to be explicit than implicit here. Initialization/destruction order is often tricky, and source of obscure bugs.