Hacker News new | ask | show | jobs
by justinpombrio 972 days ago
Some relevant PL research

STM: https://cs.brown.edu/~mph/HerlihyM93/herlihy93transactional....

Region based memory management: https://en.wikipedia.org/wiki/Region-based_memory_management

Rust lifetimes, originally from Cyclone: https://en.wikipedia.org/wiki/Cyclone_%28programming_languag...

Mutable value semantics: https://arxiv.org/pdf/2106.12678.pdf

2 comments

STM is about hardware, not programming languages, but is decently recent so maybe someone will actually try it in hardware and see if it provides a good benefit for the increased complexity of the chip.

Region based memory management was first conceived in 1967 and is achievable by any programming language that lets you manage memory yourself.

Mutable value semantics in native code have been available since at least 1980 with Ada.

Lifetimes in Cyclone seem the best example of PL research in the last 50 years you have there, as it’s only 20 years old.

Overall, I’m still unsure if this list proves the point that there is active useful research in the PL space or if it proves that there’s very little in the PL space to research. More research is probably required.

> STM is about hardware, not programming languages

As others have pointed out, there's STM research in PL, it's not entirely about hardware. (The link I gave wasn't great, sorry.)

> Mutable value semantics in native code have been available since at least 1980 with Ada.

Could you link to the relevant docs? I wasn't aware Ada had anything like this.

Is this implemented under the hood with deep copying? Because if so, that would explain why it hasn't started to catch on anywhere until now. Swift and Hylo have much more efficient implementations that "copy all the time".

https://www.jot.fm/issues/issue_2022_02/article2.pdf

> Region based memory management was first conceived in 1967

There's active research in this general space. I met someone who was working in it on a train, though I forget the details.

> and is achievable by any programming language that lets you manage memory yourself

Sure. I mean Rust lifetime discipline is "achievable" in C too, so long as you're very very careful.

> Lifetimes in Cyclone seem the best example of PL research in the last 50 years you have there, as it’s only 20 years old.

It typically takes 10+ years for PL research to go from papers to research languages to being incorporated into"real" languages.

> More research is probably required.

Always.

> STM is about hardware, not programming languages

STM is not about hardware, it's literally "software transactional memory" and is meant to be implemented in software without hardware support (beyond a CAS instruction or a similar set of instructions, perhaps). As a software component it could be part of libraries or part of a programming language as part of that language's general concurrency model.

The paper that OP linked to is indeed about hardware transactional memory, but STM is a variation of transactional memory that is implemented entirely in software.
Rust compiler enables trivial parallelism by enforcing multiple readers ^ writer; and it’s beautiful.

See Rayon.

I wouldn't say it's trivial but yes it's there and it's very helpful.
There are many cases where you can replace a call to `.iter()` in your Rust code to a call to `.par_iter()` from `rayon`. Those cases are trivial, and it's great.
That's a very nice feature but I don't know that it belongs in the category of new ideas from programming language theory. Fortran 90 had automatically parallelized language constructs and OpenMP added them to C and C++ as compiler intrinsics in 2002.
Yes, that one I like a lot.