← Back to context

Comment by mrkeen

5 hours ago

All of the "my non-Haskell language does this" comments in the thread are the same (with maybe a Rust exception).

The "lock" instruction is what the article is telling you to ditch.

> If the programmer forgets to lock the mutex the system won't stop them from accessing the data anyways

If the programmer forgets to "lock"

> and even then there's no actual link between the data being locked and the lock itself

lock (thing) { return thing.contents // shared, mutable array given out freely to the world }

'contents' has no notion that it has anything to do with this "lock"ing thing.