top | item 35799510

(no title)

laci37 | 2 years 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?

discuss

order

pjmlp|2 years ago

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.

actionfromafar|2 years ago

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