News for hackers. Stuff that matters.
Re:A case against security nihilism by tialaramex on Tuesday July 20, 2021 @11:10PM (#27901941)
A thing to remember about GC is that it solves only one very important resource. Memory.

If your program loses track of which file handles are open, which database transactions are committed, which network sockets are connected, GC does not help you at all for those resources, when you are low on heap the system automatically looks for some garbage to get rid of, but when you are low on network sockets, the best it could try is hope that cleaning up garbage disconnects some of them for you.

Rust's lifetime tracking doesn't care why we are tracking the lifetime of each object. Maybe it just uses heap memory, but maybe it's a database transaction or a network socket. Either way though, at lifetime expiry it gets dropped, and that's where the resource gets cleaned up.

There are objects where that isn't good enough, but the vast majority of cases, and far more than under a GC, are solved by Rust's Drop trait.

Re:A case against security nihilism by kaba0 on Wednesday July 21, 2021 @03:45AM (#27903477)
High-level languages can provide abstractions though that can manage object life cycles to a degree for you, for example dependency injection frameworks, like Spring.

Not disagreeing, just mentioning.

Re:A case against security nihilism by juki on Wednesday July 21, 2021 @07:42AM (#27904974)
And many languages also provide convenient syntax for acquiring and releasing a resource for a dynamic extent (Java try-with-resources, C# `using`, Python `with`, etc.), which cover the majority of use cases.
Re:A case against security nihilism by fauigerzigerk on Wednesday July 21, 2021 @11:10AM (#27907360)
Yes, but these features are usually optional. Library users can easily forget to use them and neither library authors nor the compiler can do anything to enforce it.

The brilliant thing about RAAI style resource management is that library authors can define what happens at the end of an object's lifetime and the Rust compiler enforces the use of lifetimes.

Re:A case against security nihilism by jolux on Wednesday July 21, 2021 @07:13PM (#27913343)
I agree that RAII is superior, but it’s not true that compilers and library authors can’t do anything to enforce proper usage of Drop-able types in GC’d languages. C# has compiler extensions that verify IDisposables are used with the using statement, for example. Granted, this becomes a problem once you start writing functions that pass around disposable types.
Re:A case against security nihilism by valenterry on Tuesday July 20, 2021 @11:57PM (#27902166)
It's not like Rust were the only or even the best language in solving the problems you mentioned. It might be the best performance focused / low-level language though.
Re:A case against security nihilism by vanviegen on Wednesday July 21, 2021 @08:21AM (#27905303)
It's not the best language for solving this type of problems? What (kind of) language would you say is even better for that?
Re:A case against security nihilism by rurban on Thursday July 22, 2021 @08:37AM (#27918132)
Actually safe languages fOR example. Pony guarantees all three safeties, memory, type and concurrency, whilst in Rust it's only a plan, just not implementated. Stack overflows, type unsafety, dead locks. POSIX compatible stdlib.

Concurrent Pascal or Singularity also fit the bill, with actual operating systems being written in it.

Re:A case against security nihilism by valenterry on Friday July 23, 2021 @01:36AM (#27927565)
Any language that offers some kind of effect system that has support for brackets and cancelation, for example Haskell or Scala.

There isn't even specific language support necessary, it's on the library level.