|
|
|
|
|
by kadoban
1683 days ago
|
|
The only case I can think of is partial success. Probably bad example off the top of my head: You're returning say a "User" which has a user_id, name, and a list of recent purchases. If the function errors out on the recent purchases, the caller may prefer that it still gets back a "User" object with the other information filled in, and then an "error" also set so the caller knows the information isn't complete. |
|
The contract is always right … how well it is expressed through language mechanics is maybe another way to contrast things here. (FWIW I think Go could tighten up a few things - dropping or shadowing errors is a bit worrying - but I’m fairly convinced sum vs product is a little too harsh of a reduction; a useful distinction but not a complete one.)