Hacker Newsnew | past | comments | ask | show | jobs | submit | tail_exchange's commentslogin

I was very skeptical of Go when I started learning it, but it quickly became my favourite language. I like how simple but powerful it is.

If I had a magic wand, the only things I would add is better nulability checks, add stack traces by default for errors, and exhaustive checks for sum types. Other than that, it does everything I want.


> exhaustive checks for sum types

Linters such as https://golangci-lint.run will do this for you.


> better nulability checks

In development: https://github.com/uber-go/nilaway


It's very ironic that the way they could have made money was the simple, but boring one: buying and holding bitcoin. Being a shitcoin day-trader is much more exciting though, and that's how they lost all their money.

Maybe that's also what will happen with AI investors when the bubble pops or deflates.


It's only a problem for the GOP if Dems do win elections again. Judging by how things are progressing, it may not happen anymore. They have complete control over everything.


The opposite for me. I'm so tired of the boring and uninspiring flat design, that Apple may have convinced me to get an iPhone next time I upgrade. I don't even notice Android updates anymore, the past 3 or 4 just look and feel the same.


I'm on the other camp. I'm so tired of the boring flat design, I'm actually considering switching to an iPhone.


Are you not worried about accessibility issues?


No. Like always, there will be visual accessibility features such as high contrast, reducing screen motion, dark mode, and reduced transparency. I never had to use them, but according to a family member who is blind, Apple is excellent in terms of accessibility.


This doesn't actually makes the process simpler.

Error handling in Go is not just writing "if err != nil { return nil, err }" for every line. You are supposed to enrich the error to add more context to it. For example:

    result, err := addTwoNumbers(a, b)
    if err != nil {
      return fmt.Errorf("addTwoNumbers(%d, %d) = %v", a, b, err)
    }
This way you can enrich the error message and say what was passed to the function. If you try to abstract this logic with a "Handle" function, you'll just create a mess. You'll save yourself the time of writing an IF statement, but you'll need a bunch of arguments that will just make it harder to use.

Not to mention, those helper functions don't account for cases where you don't just want to bubble up an error. What if you want to do more things, like log, emit metrics, clean up resources, and so on? How do you deal with that with the "Handle()" function?


Obviously I'm being terse for argument.

You can easily imagine

  InvokeWithErrorLogger(fn, fnparam, log)
or

  InvokeWithErrorAnnotator(fn, fnparam, annotatorFn)
Or any other common error-handling pattern.


Perhaps something like this?

    result := InvokeWithErrorLogger(
        func (err error) { // Error handler
            incrementMetric("foo")
            log.Error("bar")
        },
        addTwoNumbers, a, b,
    )

But the problem is that this approach is not better than just writing this, which doesn't need any new fancy addition to the language:

    result, err := addTwoNumbers(a, b)
    if err != nil {
        incrementMetric("foo")
        log.Error("bar")
        return fmt.Errorf("addTwoNumbers(%d, %d) = %v", a, b, err)
    }
Hence why all the proposals ended up dying with the lack of traction.


> there is literally nothing you can do with errors in go except bubble them up, log them, or swallow them

You can also add additional context to the error before bubbling it up. But yes, that part of the point. Instead of bubbling them up, the programmer should instead reflect on whether it is better than just log and proceed, or completely swallow them. This is what error handling is about.


> In the meantime, tariffs are raised on every country to gauge which side they are on

Why on earth would you be on the side of a country like this? Why we should be an ally of the US right now, if Trump can't even uphold agreements he signed himself 5 years ago? What guarantees do we have that, as soon as we decouple from China, the US won't treat us as a vassal because we gave up our only alternative? The only rational choice is to either be neutral or ally with China.


It looks like the consensus response is other countries embracing more multilateralism. This is a huge opportunity for proponents and governments that promote multilateralism to take charge and make it happen. Ex: China has restricted trade with Aus since 2020 because they, essentially, insulted China/didn't restrict their speech in ways that China wanted. This provides an opportunity for this to be rolled back, which is economically win-win (as most free trade is). Expect to see this sort of thing many times over between many countries in the world. Of course this is rooted in the fact that having ex-US trading partners is no significantly more valuable.

There is the second point to mention too though, which is that China is not exactly an exemplar of open markets and free trade, which is why you are not seeing many countries ally with China and form a united front against the US's trade rampage. Looking beyond the deranged policies, there are some truths in saying that China is a currency manipulator, has imbalanced trade to such a degree it causes problems in other economies, and even the somewhat more "far fetched" points about the unsustainability of a permanent trade deficit do have some truth on some level.

That is why, yes, you are seeing the EU normalize trade relations with China, but there are important caveats, like discussions about China having an expert quota and even internally capping production numbers within their own economy are on the table front and center. This would have never happened before, because China's strategy was to peg a low currency, export, and extinguish industries ex-China. Wish to some level is part of free trade, but it is underpinned in China with state sponsorship to a higher degrees in most trading partners are comfortable with (which is of course countered by the allure of cheap goods).

So another view would be that parties like the EU have new leverage against China that they can use to cut trade deals that strip out some of the abusive practices that made them uncomfortable in the past. If China is then willing to move on a bit from these approaches then the net outcome should be beneficial for the world of course.

I think that many players see the dangers of taking binary sides now more than ever. And indeed, skilled negotiators should see the advantages of playing these forces against each other to get what is best for them. In the face of the recent outrageous events, I would expect a sudden outburst of pragmatism elsewhere.


It's astonishing how much money they are pouring into a product that is just seems like a worse version of VRChat.


The government is clearly incapable of stopping him, so in the end, it doesn't really matter if it's illegal or not. He'll do it because he can, and he'll get away with it.


It __does__ matter. Pointing out that somebody is flagrantly and openly defying their oath to the constitution is important. It’s important to note that we are no longer a liberal democracy. It is important to call out the fact our republic has ended.


Very fair point.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: