Re:Modula-2 Reloaded – A Modern Typesafe and Literate Progra...
by cbd1984 on Monday December 28, 2015 @05:14PM
(#10803717)
> Region allocation (Ada) - used in some real-time systems. Rare.
Equivalent to solving the halting problem unless you're writing toy software with extremely well-defined inputs and outputs. Good for device drivers, maybe, but not in the general case.
Memory allocation needs to be addressed better. There seems to be a NEW, but no mechanism for deletion. (Wirth did that in Pascal. It didn't work out well.) Is this language garbage-collected?
For memory allocation, these are the known options:
- Garbage collection (scripting languages, Go, LISP, etc.) - safe, but causes stalls.
- Reference counting - (Python) safe, but can leak if you have loops. Usually adds overhead. May need a GC as a backup.
- Single-ownership without borrow checking (C++11) - partially safe, errors can be detected at run time, but this is not guaranteed.
- Single-ownership with borrow checking (Rust) - safe, complicated at compile time, but works.
- Region allocation (Ada) - used in some real-time systems. Rare.
- Manual deletion (C) - unsafe, leads to many bugs.
The manual option is probably unacceptable at this late date.