4 ms·
> This naive style implementation could work, however it would cause a lot of branching code. Would this have been a problem in practice I wonder, premature op
by MrBuddyCasino 6y ago
> This naive style implementation could work, however it would cause a lot of branching code.
Would this have been a problem in practice I wonder, premature optimization and all.
- DougBTX 6y agoYeah, it’d be interesting to see the Rust code contrasted with correct C versions. How does the C code deal with a monitor being unplugged? I wonder if it could be shuffled around to amount to an early return with an Unplugged error.
- vbezhenar 6y agoIf I understood it correctly, monitor doesn't really go away in your event handler, so C code don't have to deal with that.
- cycloptic 6y agoIn C, you're supposed to listen for a "destroy" event on the output and then in the handler you would delete all your references to the object. I would be interested to know if any language has a way to statically analyze this, instead of using a monad.
- imtringued 6y agoRust has the try! macro or ? operator so people already thought about this problem a lot. Rolling your own monad wasn't the best idea.