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

The Mutex/RwLock would be a runtime guarantee, while with this, you can make it a compile-time guarantee.

I think that mutex are actually a really good example of what he's talking about in the article. You can only access the data from a Rust mutex through a `MutexGuard` returned from the lock method. `MutexGuard` is uncloneable and therefore, when it is dropped at the end of its scope, the mutex knows that it is free and can automatically unlock it. Additionally, it is impossible to access the data without having the `MutexGuard`, so you can statically determine at compile time that all data access is behind a lock.




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

Search: