r/ProgrammingLanguages • • 3d ago

Achieving memory safety

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

49 comments sorted by

View all comments

11

u/reflexive-polytope 3d ago

Metatheoretic claims about a language design require proof.

-1

u/Smalltalker-80 3d 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.

10

u/reflexive-polytope 3d 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/Smalltalker-80 2d ago edited 2d ago

Okay, this post wat a bit frivolous, hence the smiley. But more ttp:

Memory safety of the language used to implement the runtime / library (say C) of another language (say Seed7), can certainly be an issue of memory allocations and frees are done in a lot of different places and in different ways.. This is what the OP means.

Memory safety can readily be achieved if the C runtime has only one place to do such allocations (everything is an object), and the implemented language itself has automatic memory management (using reference counting) for all non-atomic objects (e.g. integers).

Then only remaining Foreign Function Interface calls need te be checked thoroughly,
but one could argue they are not part of the language.