alias annotations - unque / owned / shared / lent
Jason House
jason.james.house at gmail.com
Thu Jan 31 14:22:49 PST 2008
In http://d.puremagic.com/issues/show_bug.cgi?id=1654, Andrei Alexandrescu pointed out the following paper:
archjava.fluid.cs.cmu.edu/papers/oopsla02.pdf
Since it seems to resonate with my thoughts (on const casting), I figured I'd try to gauge the reactions of others. I was also lazy and stopped reading when I hit the lambda calculus.
In a nut shell, they introduce the following types:
unique - A unique copy/reference to data
owned - A piece of data with exclusive access rights by the containing class
lent - A temporary copy of a variable. Can be used within a function, but no residual copy can be kept, and it can't be returned from functions.
shared - A global variable that can be accessed from many places
They also have alpha, but it seems to be a distinct type that doesn't play nicely with anything else, and I didn't see it described up front.
Page 4 of the document gives casting rules.
I guess I've always thought of stuff in a more complicated fashion where this type of property can be done based on write access rather than complete ownership.
More information about the Digitalmars-d
mailing list