Re:GRPC.io is interestingly different from CORBA
by dawidloubser on Saturday August 29, 2015 @06:35PM
(#10141586)
I'm not trying to be facetious, but do you literally just mean Haskell? Because none of the languages widely used in corporate / industry do.
I'd settle for 1990s tech over 1970s tech any day when it comes to contracts (APIs).
Re:GRPC.io is interestingly different from CORBA
by lmm on Sunday August 30, 2015 @04:16AM
(#10142700)
Scala - which I've been using in corporate/industry for 5 years now - works as I described. Of course that's only my experience.
(There are certainly plenty of places stuck on older tech - but I'd think those places won't be interested in adopting something as new as GRPC)
Modern languages have a compiler-checked sum type, and protobuf can support these (oneof). You get the good parts of exceptions (being able to cleanly separate error handling from happy-path code, and doing it concisely and readably via do-notation or equivalent) without the bad parts (invisible nonlocal control flow, breaking referential transparency, hard to abstract over).
(You still have the problem of returning a new type of error condition that your client code wasn't expecting, but it's the same problem as returning a new type of successful value that your client code wasn't expecting, and you can solve it in the exact same way).