Re:Copying data is wasteful, mutating data is dangerous
by reitzensteinm on Friday January 10, 2020 @03:40AM
(#22009429)
Linear typing is obviously ideal, but you can also version expensive to clone objects, and use a struct to reference them with a pointer and version number.
That way if you mess up your algorithm and attempt to access the old version of an object from a stale reference, you at least get an exception.
If you use a struct it makes the pointers fat but there's no allocation.
That way if you mess up your algorithm and attempt to access the old version of an object from a stale reference, you at least get an exception.
If you use a struct it makes the pointers fat but there's no allocation.