2 ms·
> We've added major features such as the try operator (?), const generics, generic associated types (GATs), and of course: async/.await. Out of those four featu
by vmchale 3y ago
> We've added major features such as the try operator (?), const generics, generic associated types (GATs), and of course: async/.await. Out of those four features, three are what can be considered to be "effects".
I wouldn't call the try operator an effect, Result is a monad but it's quite different from the I/O monad in Haskell
- tialaramex 3y agoIndeed. I'd consider the current rendition of Try a magic conversion operator, not so different from IntoInterator (which powers Rust's for each loop sugar) for example, or the IntoFuture mechanism which drives async/await sugar or Display (which turns things into strings). A user defined function turns your type T into a possibly different type S which has some specific property and then an agreed thing happens to the S, using that property. In some cases your implementation is a no-op, you already did have the desired property, in other cases you must do a lot of work to make it happen.
- hurril 3y agoLet's not conflate side effects and effects.