rich-result-object

This name "rich result object" comes from blog-post-anatomy-of-a-service-object-in-rails

In Haskell, are these "maybes"?

In Rust, "Tuples can be used as ... return values".

rust-by-example-page-tuples

Actually, Rust talks about a specific result object:

rust-book-page-generics#result

The Result<T, E> type is intended to be used to return the result of a computation, and to have the ability to return an error if it didn't work out.

 

In Ruby, you can use something like project-immutable-struct, which is described in further detail in blog-post-anatomy-of-a-service-object-in-rails

return-tuples-with-ok-elixir#example-from-stack-overflow

(from http://stackoverflow.com/questions/31192923/lists-vs-tuples-what-to-use-and-when here is an example)

"Contrast this with a typical use-case for tuples - returning {:ok, result} or {:error, reason} from a method - here the number of elements is known up-front and so you don't pay an unacceptable price for the performance improvements of Tuples."

 

Referring Pages

blog-post-anatomy-of-a-service-object-in-rails