4 ms·
Lambda crabs, part 1: A mathematical introduction to lifetimes and regions
- albertoleal 10y agoPart 2 here: http://ticki.github.io/blog/lambda_crabs_2/ http://ticki.github.io/blog/lambda_crabs_2/
- RangerScience 10y agoI know next to nothing about Rust, which makes this all kind of opaque. Can you link a good Getting Started for Rust that pairs well with these?
- adamnemecek 10y agoYou can start with this https://doc.rust-lang.org/book/ https://doc.rust-lang.org/book/
- eximius 10y agoMy goodness! A Lattice (not the linear algebra kind, the abstract algebra kind) being used in the wild? I genuinely never thought I'd see those again outside my analysis textbook. Ticki does really great work in Rust. I think the only thing he's doing that I disagree with is his RFC for a keyword for dynamic dispatch (all we really need is to distinguish trait objects - dynamic dispatch is just the symptom).
- yomritoyj 10y agoLattices are used to provide a theoretical basis for dataflow analysis in compilers. See Chapter 9 of Aho et al.'s book on compilers. Ordered sets also occur in denotational semantics http://homepage.cs.uiowa.edu/~slonnegr/plf/Book/Chapter10.pdf http://homepage.cs.uiowa.edu/~slonnegr/plf/Book/Chapter10.pd...
- asQuirreL 10y agoLattices and the associated Galois connections are used quite a bit in the Abstract Interpretation school of program analysis [1]. [1]: https://en.wikipedia.org/wiki/Abstract_interpretation https://en.wikipedia.org/wiki/Abstract_interpretation
- the8472 10y agoSeems to be common among compiler theory people http://www.cliffc.org/blog/2012/03/24/too-much-theory-part-3/ http://www.cliffc.org/blog/2012/03/24/too-much-theory-part-3...
- transfire 10y agoHow did this make it to the front page? It is so esoteric to begin with, and so poorly explained beyond that... it's not even useful to most of the people it is intended. All that aside, can we stop making up new words for things that already have words? -- correction, can we stop re-purposing old words for old things and acting like they're new? I mean really, “outlives or equals to”?
- sklogic 10y ago> It is so esoteric to begin with If abstract algebra is so "esoteric" for you, I'm afraid you should rather read Trump speeches instead of following HN. > I mean really, “outlives or equals to”? Suggest a better alternative and prove that we should throw away decades worth of papers and start using your new terminology.
- igravious 10y agoFTA: “Regions have an outlive relation defined on them.” Typo? Should that be outlives? We say equality, inequality, equivalence (equal valence, i.e. value) relation. To be equal -> equality. To outlive -> ? Valid question, outlives doesn't quite fit? To exceed the lifetime, to go beyond the region -> an excession relation, an overboundedness relation? I jest (in part). Naming things is hard! One of the two hard things in programming, as they say. > Suggest a better alternative and prove that we should throw away decades worth of papers and start using your new terminology. “outlives or equals to” -> “outlives or is equal to in scope/duration” reads better to my ears. So it's not even to outlive, it's to live for the same amount as or outlive. GP has valid language use concerns. And yes, abstract algebra is esoteric. ps: The Trump swipe is crass.
- sklogic 10y agoOk, I see, 'outlives' is much better. But I guess he's complaining about the very choice of the relationship names, not nitpicking about grammar. > abstract algebra is esoteric. How is it so? It's fundamental and essential. "Esoteric" implies "mostly useless", which is definitely not true.
- ekidd 10y agoThese articles explain the mathematical underpinnings of Rust's borrow checker. The explanation is actually fairly simple, but it assumes prior familiarity with abstract algebra. For people who are unfamiliar with posets, lattices, etc., this introduction might help a bit: http://old.iseclab.org/people/enji/infosys/lattice_tutorial.pdf http://old.iseclab.org/people/enji/infosys/lattice_tutorial.... (PDF) For introduction to how Rust's ownership/borrowing/lifetimes system works, see the three chapters starting here: https://doc.rust-lang.org/book/ownership.html https://doc.rust-lang.org/book/ownership.html And a "standard disclaimer" for math: To understand this material, you may need to read slowly, look things up, and work through each example. Math is often very simple, but that doesn't mean that it's easy. The trick is usually to stare at it from enough different directions that the underlying simplicity finally "clicks," and you wonder how you could have ever been confused. If you're unfamiliar with the topics in question, a page per day can be a perfectly acceptable reading speed.
- Chris2048 10y agoI think this might be relevant: https://news.ycombinator.com/item?id=11746913 https://news.ycombinator.com/item?id=11746913 http://arxiv.org/pdf/1503.07199v1.pdf http://arxiv.org/pdf/1503.07199v1.pdf