4 ms·
I wrote something similar in C++, completely compile time that disappears at runtime: https://www.fluentcpp.com/2019/09/24/expressive-code-for-state-machines-in
by nitnelave 7y ago
I wrote something similar in C++, completely compile time that disappears at runtime: https://www.fluentcpp.com/2019/09/24/expressive-code-for-state-machines-in-cpp/ https://www.fluentcpp.com/2019/09/24/expressive-code-for-sta...
Although the language itself doesn't guarantee that the value is not used again after a move, good static analyzers will provide a warning in that case, so it can still be safely used.
- pcwalton 7y ago> Although the language itself doesn't guarantee that the value is not used again after a move, good static analyzers will provide a warning in that case, so it can still be safely used. Not soundly. Such static analysis can be trivially defeated using e.g. virtual methods.
- nitnelave 7y agoTrue, it's not bulletproof. However, with a bit of discipline it's possible to use it safely. And anyway, it's already an improvement over just documentation like "don't call this until you called that"