This talk of geocentric and heliocentric models makes this thread start remind me of Euclid's Elements.
In Euclid's famous book demonstrates 465 proofs of all manner of things, many quite complicated, in 13 chapters. A total of 130,000 words, on 545 pages. Rather like this thread, no?
However Euclid starts with only 5 very simple axioms that school children understand and anyone can remember:
- A straight line may be drawn between any two points.
- Any terminated straight line may be extended indefinitely.
- A circle may be drawn with any given point as center and any given radius.
- All right angles are equal.
- If two straight lines in a plane are met by another line, and if the sum of the internal angles on one side is less than two right angles, then the straight lines will meet if extended sufficiently on the side on which the sum of the angles is less than two right angles.
And all the rest of the book follows from those axioms. It is not necessary to remember all the proofs in the book. One only has to remember the 5 axioms, then one can recreate everything else.
These axioms form a "model". Typically called Euclidian Geometry. Change one of those axioms and we have different models. Notoriously changing the 5th axiom results in hyperbolic geometry or whatever.
Similarly we see a lot of discussion here, all kinds of demonstrations of borrows and lifetimes. Which, quite frankly, get complex enough I stop following.
The OP asks what is the model of the borrow checker. Surely that is akin to asking what are the axioms of the borrow checker? As far as I can tell they go like this (correct me if I am wrong):
- No data can be used before it is created.
- No data can be used after it is destroyed.
- If data is used for writing there can only be one user.
- If data is only used for reading there may be many users.
What have I missed? Following Euclid I feel there should be a fifth axiom.
Of course I have expressed the axioms very non technically, casually speaking of "data" and "using". Perhaps someone could write them more technically referring to "bindings", "references", "borrows" or whatever.
Like Euclid these axioms should be self evident to the reader. Of course we don't want to use uninitiated data (1), of course we don't want use after free(2), of course we don't want race contains(3 and 4). All else that the compiler complains about should be understandable from these few axioms.
Like Euclid with these axioms in mind, the model, everything else should be deducible by the reader, every compiler borrow checker area should be understandable. All be it not so obviously.
That's it, that is my mental model.