Email or username:

Password:

Forgot your password?
Top-level
Hrefna (DHC)

@12
Java attempted to deal with this with checked exceptions, which made a lot of people angry and are now widely regarded as a bad idea.

A lot of languages have this pattern, but it doesn't feel nearly as contrives or ugly as it does in Go. In functional languages (Scala's Try blocks, Ocaml's Result and Or_error systems) you get nice first-order structures, so your code becomes:

(do a thing).map(
do something else
).map(
do something something else
).iferror(
handle it!
).getValue

7 comments
12 Lilith it/its๐’€ญ๐’ˆน๐’ ๐’Šฉ replied to Hrefna

@hrefna yeeeesh. We feel like as a kid we learned like a weird bastardised combination of C and Python? and that has just absolutely stuck with us, and then we learned C#......... of the terrible projects we created in C# we hall not speak

Hrefna (DHC) replied to 12 Lilith it/its๐’€ญ๐’ˆน๐’ ๐’Šฉ

@12 My first language was hypertalk, which is a bizarre language but also a very cool one.

It's _really_ hard to shake early paradigms with languages. I'm generally of the view that languages are easy, but learning the ecosystem is difficult and learning paradigms is difficult

I've seen programmers with decades of experience segfault entirely when running into a different paradigm.

So you aren't alone in that, and in this case they picked up none of the things that makes that patternโ€ฆ work.

12 Lilith it/its๐’€ญ๐’ˆน๐’ ๐’Šฉ replied to Hrefna

@hrefna yeah, the paradigm we learned was... very C-style. Very very C. Not that we can hack it in C; the only thing we ever wrote in C were some truly dirty Linux kernel hacks

Hrefna (DHC) replied to Hrefna

@12 But in go you:

a) Lack generics
b) Lack any of the functional patterns
c) Lack pattern matching
d) Are using a lot of the patterns for programming that are common in the C-derived world.

So you end up with code that is extremely verbose and contains a lot of if-else-if-else-if-else calls.

Which even for someone who prefers to avoid try-catch blocks in languages with good semantics for it makes me _really_ twitchy ^^;;

Hrefna (DHC) replied to Hrefna

@12 Oh, and one more note on this, in the languages with operator overloading this becomes downright _clean_. It becomes something like:

RunSomething >>| do_something_with_result >>| do_another_thing >>= deal_with_errors |> add_callback

Now it can even be concurrent and still nice and clean, with no changes to the code.

Which is why a lot of people like this pattern, but it does involve a different way of thinking, and I'd argue its absence from go is keenly felt.

Go Up