3 ms·
>And if there is something useful to be returned, then you’re dealing with a product type anyway. And how do I know if I'm dealing with the product or sum type
by ernst_klim 8y ago
>And if there is something useful to be returned, then you’re dealing with a product type anyway.
And how do I know if I'm dealing with the product or sum type if the former is absent and emulated by the latter?
>I don’t know why they’re hard to understand, but they are notorious.
Citation needed.
>more abstract than is helpful in the majority of programs
They are neither more abstract nor less useful than the iterator pattern. I.e. you don't need either if your programs are trivial or your language has baked in constructs for the semantics they ought to provide, though both are unavoidable when you need to implement iteration or operational semantics in general for the case not foreseen by the language creators.
It's a shame that both are neglected in Go, and Go programmers would write these `if (err != nil)` snippets all the way making dozens of errors due to lack of DRY or iterate over a tree using loops.
>only that in general they cost more than they contribute when the objective is shipping a product.
Citation needed. Need an evidence of clear, generic, literate and domain-driven code being more expensive that a typical Go spaghetti of loops and if (err!=nil). I could believe that its cheaper because of Go developers being cheaper,but the technical debt couldn't be smaller due to verbosity, code repeat and lack of expressiveness to separate the domain logic from the low level programming stuff like iteration and error checking.
- weberc2 8y agoIt is just based on experience and common sense (although I’m sure you can come up with some awkward justification for why Haskell has only delivered a fraction of the successful products Go has done despite having been around so much longer and despite being The One True Programming Language). I’m not bothered about whether you believe me or not to be honest. Frankly, I’ve lost interest in the conversation. You seem very defensive and threatened by the success of a programming language, and that’s just the saddest and most disinteresting thing I can think of.
- ernst_klim 8y agoWhat are you talking about? Go is a niche language [1] just like Haskell, and the amount of successful projects in it could be counted on one hand (aka docker and kubernetes). Popular languages are Python, Java, Javascript, and they all use either monads (java, C#) or exceptions (Java, C#, Python, Js). Also Java, C# as well as the new languages like scala, rust or swift are all influenced by haskell or ML in some way (option/result types, variants), while `if err != nil` is indeed a very obscure and opinionated way of signaling error, which exists in Go and in some very legacy langs only. Java wants to be more like ML than like Go [2] [3]. [1] https://trends.google.com/trends/explore?date=today%205-y&q=Golang,java,javascript,python,php https://trends.google.com/trends/explore?date=today%205-y&q=... [2] https://www.youtube.com/watch?v=HSk5fdKbd3o https://www.youtube.com/watch?v=HSk5fdKbd3o [3] https://www.youtube.com/watch?v=n3_8YcYKScw https://www.youtube.com/watch?v=n3_8YcYKScw