fuzion
fuzion copied to clipboard
Warn if atomic field is created on value type, or should atomic be `ref`?
some_feat is
x := atomic i32 3
If we use some_feat and pass it around, copies are made of x, which I think is a racy_read and also probably not what is intended.
Maybe instead of forbidding atomics in a value type, we could have a property.not_cloneable (or not_clonable?), let atomic inherit from this property and flag an error if a value that is not_cloneable is passed as a value?
Another possibility that might be easier is to make atomic a ref. I find this a little unsatisfactory since it adds a level of indirection in many cases where this is not needed.