3 ms·
> infer or constrain the amount of copies and allocations a piece of code has That's exactly what substructural logic/type systems allows you to do. Affine an
by zozbot234 9mo ago
> infer or constrain the amount of copies and allocations a piece of code has
That's exactly what substructural logic/type systems allows you to do. Affine and linear types are one example of substructural type systems, but you can also go further in limiting moves, exchanges/swaps etc. which helps model scenarios where allocation and deallocation must be made explicit.
- NeutralForest 9mo agoI don't think it's been integrated in any mainstream language though.
- DonaldPShimoda 9mo agoI think by default Rust uses affine types, but that's about the extent of it.
- NeutralForest 9mo agoI know some research languages are playing around with linear types, I wonder if we'll see it show up in some language or another.
- johnbender 9mo agohttps://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/linear_types.html https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/line... Experimental and of course one can debate whether Haskell is mainstream but I figured it merits a mention.
- boltzmann-brain 9mo agodo they allow the following? https://news.ycombinator.com/item?id=46859860 https://news.ycombinator.com/item?id=46859860