Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: Go 2: sync/atomic: type modifiers as an addition to types #29501
My proposal is to introduce type prefixes subsystem.In another words: make simple,readable way for making data atomic, shared, imutable, etc
--With descibed feature:
Ofcourse, there are several issues:
-For the first one, cure is to use & operator which should has *int64 return type, not atomic *int64 nor
-For the second one, my proposal is to make a kind of system, that describes variable in much abstract way, in order to allow inserting custom code before and after any kind of operation with variable. In another words: make Pre-acess and Post-acess parts in data operation model, used in code generation process. I think it won't be much penalty, because such thing will allow future modifications in that way to be easier to implement.
For swap and compare-and-swap there is still Atomic package.
P.S Another such modifiers I would like to see are "const" and "binary serialisable"(loading from byte exactly in ram)(hello protobuf!). You are welcome to suggest your ones.
I see my mistake, the & operator really should have *(atomic int64) return type (adress of atomic , not content) ,and it won't be a cure.
I don't really understand how this is supposed to work if the address of a
Seeing that the use of
See previously the
Type modifiers do not seem particularly useful unless they can be tracked across function calls and through pointers and other data structures, and the details of making that tracking work quickly become so verbose as to not fit in with the rest of the design of Go.
(Note that I withdrew that proposal for that reason in #24956 (comment).)