[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: file.png (181 KB, 750x920)
181 KB PNG
OMG, i am excited for another day of coding in Go. i can't wait to drizzle
if err != nil {
}
all over my code.

there is no better feeling in this world than typing
if err != nil {
}
every two lines of code.

I am so glad 40% of my codebase is
if err != nil {
}

writing
if err != nil {
}
gives me an orgasm.

writing
if err != nil {
}
got me countless women lusting after me.
they are impressed by how fast i can type
if err != nil {
}

writing
if err != nil {
}
changed my life
>>
>>108781863
Why can't Go programmers understand Monads?
>>
>>108781863
Every single time
>>
>>108781863
https://go.dev/blog/errors-are-values#:~:text=It%20is%20very%20repetitive.
>>
>>108782192
actually neat
>>
>>108781863
rust and no inheritance is same faggy shit as go and exceptions. these languages created by woke faggot contrarians.
>>
>>108782342
things like that are stuff people don't learn because they don't follow the fucking go tour and related blogposts: https://go.dev/tour/concurrency/11
>>
File: 1770059352304895.jpg (67 KB, 400x523)
67 KB JPG
>>108781863
>getting filtered by error checking
Midwit.
>>
>>108782357
exceptions are just the objectively proper way of doing error handling. idk why people felt like they needed to reinvent shit.
>>
>>108781863
This and the lack of OOP made me not even try this language.
>>
>>108781863
ok, don't use it?
I think it's a fine language with some minor wars (but err != nil is not one of those) and a weakish type system but it gets the job done
>>
>>108782367
>needing to error check at all
ngmi
>>
That’s the true Go developer progression:
>“Why is there no exceptions system?”
>“Why am I writing if err != nil every 14 seconds?”
>“Actually… explicit control flow is kind of beautiful.”

Stockholm syndrome.

You start judging languages that hide errors.
Eventually your fingers evolve into this autonomous organism:
func spirituallyCorrect() error {
x, err := doThing()
if err != nil {
return err
}

y, err := doOtherThing(x)
if err != nil {
return err
}

z, err := doImportantThing(y)
if err != nil {
return err
}

return finalize(z)
}

And then one day you discover:
if err != nil {
return fmt.Errorf("failed to drizzle: %w", err)
}

and suddenly you’re not just coding — you’re crafting artisanal contextualized failures.

Meanwhile every Rust programmer is building a 900-layer trait abstraction so they can avoid writing four lines, and every Java developer is summoning stack traces from the underworld with FactoryBuilderManagerProviderException.
Go just stands there calmly:

>“An error occurred.”
>“Would you like to handle it?”
>“Right here. Right now. Like an adult.”

Peak engineering.
>>
>>108783391
good morning chatgpt
>>
Go developers should just buy a detachable macro-pad to bind the boilerplate to.
>>
I tried kotlin for a bit and I liked the elvis operator `?:` they had. You could use it to early exit if the expression was null.
You can do stuff like:
```
val x = doSomething() ?: return
doSomethingWithX(x) // x guaranteed to be non-null here
```
With a little more thought I wonder if it can be worked into a way in go so that it can check the error variable and let you return immediately. If it's such a common pattern in the language it'd be worthwhile to have first party support for such a construct.
Scope functions, and particularly one dedicated for the error variable, could also potentially be used to make it less repetitive or be written better.
>>
>>108781863
>handling errors is... le bad
>>
>>108783391
Odin has some sugar to reduce the repetitive verbosity.
>>
>>108783391
Wait until you learn this:

doThing().flatMap(x => doOtherThing(x)).map(y => doImportantThing(y))
>>
>>108781863
I can live with this however
>runtime
ick.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.