News for hackers. Stuff that matters.
Re:Updating the Go Memory Model by to11mtm on Monday July 12, 2021 @10:24PM (#27817107)
Yeah this can be a hard problem to solve.

In most managed languages to 'properly' deal with it you typically need to accept locking on some level (like with ConcurrentDictionary in C# or ConcurrentHashMap in Java).

One semi-elegant (yet internally complex) solution I've seen; in C# there is the language-ext library. All the collection types are structs (value types where things like .Add() return a new struct) however the struct itself just holds an implementation to a class. This works well from a user standpoint but the internals of the code is... interesting to say the least and can still lead to a lot of allocations if you're not careful.

There are no comments on this comment yet.