Re:Let's Remove the Global Interpreter Lock
by breatheoften on Monday August 14, 2017 @08:34PM
(#15014358)
Ah I see -- Can you actually describe ownership in python sufficiently well to be able to describe this move operation for any useful python data structures?
[ Parent
| on HN ]
Re:Let's Remove the Global Interpreter Lock
by kllrnohj on Tuesday August 15, 2017 @10:51AM
(#15018702)
Generically ownership is simply who has a reference to the object.
So if a.foo = b, then a 'owns' b. A 'move' is simply handing a different object the reference, then dropping your own reference. For example:
a.foo = b // a 'owns' b
c.foo = a.foo // a & c share b, however if the next line is:
a.foo = None // a has 'moved' b to c, since c now has the only reference to b.
Some languages have codified this to make the contract part of the language, but it doesn't need any first-class language support. It's just a pattern at the end of the day.