Re:Strong Types and Their Impact on Testing
by icebraining on Tuesday November 18, 2014 @01:39PM
(#8625462)
This has been discussed in pretty much every golang thread here on HN :)
Re:Strong Types and Their Impact on Testing
by TeeWEE on Thursday November 20, 2014 @12:45PM
(#8636986)
When I started go, i also thought it was nuts. And it indeed clutters your code a lot. But in the end, i like it.
Golang is a really simple language, but all the simple concepts, and the lack of OOP, forces you to think more about your code. Also you are forced to think about error conditions.
I'm still playing around with it. So i dont have a final opinion on go.
Re:Strong Types and Their Impact on Testing
by ecopoesis on Tuesday November 18, 2014 @01:39PM
(#8625461)
Not if you use Scala. With Scala, you'd just map or for comprehension over the result.
Furthermore, the sendEmail and validateEmailForm values are essentially ignored and used only for their possible error values.
Why should I wrote my program as if the thing I'm concerned primarily with is errors? Much better to encode the failure into the type. You could have, for example, some function that returns Either[Error, SendEmailAction] where SendEmailAction is a function that, when called, will perform the effect of sending an email. Now I can deal with the happy path by mapping on the right-biased Either.