Hacker News new | ask | show | jobs
by laci37 1142 days ago
I think the author has left out a big piece why Rust enables better interface here: ownership. In C++ could the compile time checks prevent me from creating both an input and output type working on the same pin?
2 comments

Yes, you would have different set of classes with invariants.

With template metaprogramming those invariants can be done at compile time.

It is a matter of type system design, the whole point of type-level programming.

Yes! Hell we did such things in C and a little custom build tool support.