I remember hearing of a “sad story” of somebody passing a Map through a channel in golang and multiple threads started using it, it corrupted the Map itself by doing simultaneous insertions. Seg faults, etc.
I think golang added some “primitive” double checks for this kind of behavior (e.g. panic if accessed while being mutated).
Would there be support for adding something similar in crystal?
While we’re at it, java does something similar, throws a “ConcurrentModificationException” if you mutate a Map or List while iterating over it (even in the same thread). Would there be support for adding something similar?
Wanting to decrease the potential of segfaults here…
Thanks for your thoughts.