Hacker News new | ask | show | jobs
by EVa5I7bHFq9mnYK 592 days ago
All this "advance" stuff does is work around the too clever memory model and allow to simply allocate data on stack, something invented ~60 years ago.
1 comments

C# always supported stack allocations and always supported things like stack-based pointer operations. It just tagged a lot of it as "Unsafe" and/or required the `unsafe` language keyword (and concomitant security escalation in the old Framework security model where assemblies that used `unsafe` code needed additional code certificates to be installed into places like the GAC).

The "advanced" stuff is very much about bringing Rust-like lifetimes to the language and moving the powers and capabilities outside of the `unsafe` keyword world, by making it much less unsafe in similar ways to how Rust does lifetime/borrow-checking but converted to C#/CLR's classic type system. It's adding the "too clever" memory model of Rust to the much simpler memory model of a GC. (GCs are a very simple memory model invented ~70 years ago.)

70 years ago the memory model was: keep all data in global static memory locations (Fortran). Then Algol and Pascal came around, implementing the stack memory model.
Lisp was released in 1958, same as Algol, and doing some form of garbage collection from that humble beginning.