Hi,
although I too am fascinated by the abstraction of Dry::Monads, I share the suspicions of others about readability and introducing just more »syntax sugar«.
The monads-concept feels natural in rust, where its an integrated part of the language, but is a kind of artificial for a pure oop-language like ruby.
Rubyists must not fall into the same traps, perl developers did in the past, by just implementing anything form other languages just because its "Zeitgeist".
Its definitively not a substitute of if then else branching, however, in certain circumstances a smart enhancement .
Thanks for sharing!
Returning a String, a Boolean, or an Integer do not give enough context. Using monad is a simple way to identify if it's a Success or a Failure, depending on your business logic.
There are other gems that help you to encapsulate the logic. The concept of encapsulating logic in order to give more context is not new.
The idea behind all that is to improve readability. I agree it's a new syntax. But once someone explained you / show you some example, it's very easily understandable.
Of course, you cannot just erase all the if in your code with using Monads, it is not THAT magic ahah. And for sure, I still use some return Failure() if xxx.
Let me know if you want to talk more about it, and maybe I can find some more complex codes example ?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi,
although I too am fascinated by the abstraction of Dry::Monads, I share the suspicions of others about readability and introducing just more »syntax sugar«.
The monads-concept feels natural in rust, where its an integrated part of the language, but is a kind of artificial for a pure oop-language like ruby.
Rubyists must not fall into the same traps, perl developers did in the past, by just implementing anything form other languages just because its "Zeitgeist".
Its definitively not a substitute of if then else branching, however, in certain circumstances a smart enhancement .
Thanks for sharing!
Hi !
Returning a String, a Boolean, or an Integer do not give enough context. Using monad is a simple way to identify if it's a Success or a Failure, depending on your business logic.
There are other gems that help you to encapsulate the logic. The concept of encapsulating logic in order to give more context is not new.
The idea behind all that is to improve readability. I agree it's a new syntax. But once someone explained you / show you some example, it's very easily understandable.
Of course, you cannot just erase all the
ifin your code with using Monads, it is not THAT magic ahah. And for sure, I still use somereturn Failure() if xxx.Let me know if you want to talk more about it, and maybe I can find some more complex codes example ?