Hacker News new | ask | show | jobs
by wazzaps 997 days ago
Copying a mutex by value (thus duplicating the lock, causing deadlocks or worse) is far too easy
2 comments

`go vet` catches this.
I use a tool called "type theory"
Keep posting about D, I'm sure it will catch on soon.
Is there a way to declare any type uncopyable? This is something I always thought Ada got right.
you stick this in your struct

    type noCopy struct{}
    func (*noCopy) Lock()   {}
    func (*noCopy) Unlock() {}
Wow, even c++ won't let you do that (without invoking undefined behavior, anyway).