Hacker News new | past | comments | ask | show | jobs | submit login

Copying a mutex by value (thus duplicating the lock, causing deadlocks or worse) is far too easy



`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).




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: