3 ms·
At the machine level there is no ownership. A computer has fixed amount of RAM and CPU can change an arbitrary word at any time. Ownership is an attempt to par
by fpoling 6y ago
At the machine level there is no ownership. A computer has fixed amount of RAM and CPU can change an arbitrary word at any time.
Ownership is an attempt to partition that with the goal of simplifying things and say that particular area of memory can only be modified/accessed at particular time by particular code. Isolated memory between processes does that at OS level, Rust and OOP try it inside a particular process, but they do it in a different way.
- chrismorgan 6y agoI wondered if anyone would call me out on that, when I first wrote it! I agree: at the most fundamental level data types aren’t real; even pointers don’t exist, they’re just a convention. What I was trying to get at is that at the fundamental level everything’s a value; when comparing high-level and low-level memory models, the key difference is whether everything’s a value or a reference (though many high-level models still support some kind of value types). When you have value types, ownership is real, and reflects how the machine works. Because the real world of CPUs isn’t quite that theoretical fundamental level: there are instructions for dealing with pointers; the concept of the stack is built in; things like that. If you have a stack variable, it’s inherently owned by the one place (though whether the language freely permits mutation from multiple places is another matter). So yeah, in the end I maintain my position that ownership semantics more closely match how computers work at that low level.
- baetheus 6y agoI agree! At the most fundamental level (that I know of) all bits are two ranges of voltage, light, or magnetism in a system (although I am aware of deeper understandings based in physics). We have decided to give the meanings of 0 and 1 to those ranges. We have also given meaning to collections of bits by calling them pointers or ints. We have given meaning to other collections of bits by encoding various symbols in them and a logic based on those symbols. My point here isn't to be pedantic but to argue this point: The fundamental quality of computing is that it abstracts a physical system to a logical one. In this light the realness of a data type is the same realness of a bit, since they are both structures that give way to a more defined logical system, one built on the next. To speak to the OP's claim of a category mistake I think he misses this valuable insight. The "realness" of programming objects and the semantics of moving them and copying them is the same "realness" of the bit or the data type. This is to say that the category that programming objects are contained within is, for lack of a better phrase, "the category of logical abstractions built on physical systems". The reuse of "move" and "copy" to represent similar processes to those we use with physical systems is a "logical encoding", not an error. In fact, the op makes the categorical mistake by saying that we mean "physically move" when we mean "logically move". That said, this was an interesting read in spite of my disagreements with some assertions.