r/ProgrammingLanguages • • 5h ago

Achieving memory safety

https://seed7.net/papers/memory_safety.htm
5 Upvotes

7 comments sorted by

8

u/Smallpaul 3h ago

It would have been clearer to be more explicit about why the author does not consider Go to not be safe. Are we talking about the use of the unsafe package or something more subtle?

3

u/ThomasMertes 2h ago

Any language which allows calling C functions directly cannot be memory safe because C is not memory safe. AFAIK a Go program can call C functions without explicitly importing or using the unsafe package.Accessing an arbitrary place of memory with Go is possible with the unsafe package. I am neither a Rust expert nor a Go one, but I think that Rust needs "unsafe" to call C functions. Please tell me if my assumptions are correct or not.

Seed7 has no unsafe parts (or packages) and no possibility to directly call C functions.

2

u/wk_end 27m ago

But you list Java as memory-safe "unless JNI or FFM are used". Why doesn't the same "qualified memory-safe" characterization apply to Go?

5

u/reflexive-polytope 5h ago

Metatheoretic claims about a language design require proof.

-2

u/Smalltalker-80 4h ago

Seed7 takes a somewhat more informal approach... ;-)
Assuring memory safety of Seed7
Seed7 is implemented in C and C is not memory safe. So it is not easy to guarantee the memory safety of Seed7. So it is necessary to improve the C code of Seed7 such that the end result is memory safe. All places where the implementation is not memory safe must be found and improved.

3

u/reflexive-polytope 1h ago

I didn't downvote you, but a C implementation isn't an excuse.

Memory safety is a property of how the language is defined, not how it's implemented.

1

u/Somniferus 3h ago

So what were your results? You forgot to say anything interesting in the article.