Live data from Hacker News

Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

verdagon.dev

11–20 of 143 posts

Re: Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

#12

I’d love to see a language that kept everything as familiar as possible and implement memory safety as “the hard bit”, instead of the Rust approach of cooking in multiple different new sub languages and concepts.

Isn't that just C/C++?

Re: Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

#13
post #10
post #4

Earlier quoted context omitted.

As a long time C programmer I like Rust because it combines two things from C that are important to me (low runtime overhead, no runtime system required) with a focus on writing correct programs. Memory safety is just one aspect where the compiler can help making sure a program is correct. The more the compiler helps with static analysis, the less we need to rely on creating tests for edge cases.

> Memory safety is just one aspect I feel as though not enough attention is given to how std is designed. For example: [u8], str, Path, and OsStr may be confusing at first, but when you understand why they are there any other approach feels icky. std guides you down a path of caring about things that really should matter (at least if you're only unwrapping provably safe values). Have you considered what happens if no…

> Have you considered what happens if not-utf8 data winds up in an environment variable that you are writing to stdout? What if it contains malicious VT commands?

Unless you're talking about terminal bugs in parsing invalid UTF-8 - and parsing invalid UTF-8 is easier than rendering valid UTF-8 - VT commands are UTF-8 compatible. You just need to embed an ASCII escape character.

Re: Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

#14

I’d love to see a language that kept everything as familiar as possible and implement memory safety as “the hard bit”, instead of the Rust approach of cooking in multiple different new sub languages and concepts.

"Familiar" is subjective so it's not really something to hang your hat on.

Re: Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

#15
That is very informational. Thank you.

I am interested in Vale and it feels very promising, though because my interested in bootstrapping I don't like that it is written in Scala. I know, that is shallow, but that's a thing that limits my enthusiasm.

If you are like me and don't like jumping around between notes and text and you prefer to read the notes anyway, here is a little snippet you can run in Web Inspector's Console:

  document.querySelectorAll(".slice-contents a[data-noteid]").forEach(e => {document.querySelectorAll('.slice-notes [data-noteid="' + e.attributes["data-noteid"].nodeValue + '"] p').forEach(p => {p.style.fontSize = 'smaller'; e.parentNode.insertBefore(p, e)}); e.remove() })
It will replace note links with notes themselves making them smaller, because they will not always fit smoothly.

Re: Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

#16
post #6

It's surprising to see an article with such a large encompassing of different techniques, hybrid techniques and design interactions with the type system, but is more surprising that a whole dimension of memory (un)management was left out: memory fragmentation

It's probably because fragmentation isn't a safety issue. (In the sense of 'safety' being discussed here.)

Re: Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

#17

I’d love to see a language that kept everything as familiar as possible and implement memory safety as “the hard bit”, instead of the Rust approach of cooking in multiple different new sub languages and concepts.

Familiar to whom? I came from a JavaScript background, and Rust's syntax and "functional lite" style felt very familiar.

Re: Borrow Checking, RC, GC, and Eleven Other Memory Safety Approaches

#18
The list gets very woolly by the end. CHERI exists (though not at volume), Cornucopia Reloaded is a research paper, "plus some techniques to prevent use-after-free on the stack" is entirely hand waving.

It is really good as food for thought though.

Post reply on HN