News for hackers. Stuff that matters.
Re:HTTP/3: Everything you need to know about the next-genera... by topicseed on Saturday February 12, 2022 @07:32PM (#30317838)
> I have an irrational hatred for the Go language

Do you mind sharing why?

Re:HTTP/3: Everything you need to know about the next-genera... by linkdd on Saturday February 12, 2022 @07:42PM (#30317913)
My biggest annoyance is that the Go language is full of implicit conventions/behaviors:

  - interface implementation is implicit
  - "export" is based on the function/type/member name (first letter uppercase)
  - private functions/types/members are private within a package not a single file
  - ...
This is painful because when you read a single file, you need to know about the rest of the code. This makes it very hard to get started with a new codebase, especially a huge codebase.

The other annoyances I have are just petty, like "if err != nil", zero-values, or the fact that VS Code still does not support Go projects in subdirectories (I like to open my whole "devel" folder).

Re:HTTP/3: Everything you need to know about the next-genera... by yzmtf2008 on Sunday February 13, 2022 @12:29AM (#30319519)
> interface implementation is implicit

Fun fact: this is true for python too! https://stackoverflow.com/questions/40764347/python-subclass...

Re:HTTP/3: Everything you need to know about the next-genera... by iljya on Sunday February 13, 2022 @03:46AM (#30320311)
> VS Code still does not support Go projects in subdirectories

This is annoying, but there is a workaround: add each folder with a go.mod file individually starting with the most nested ones first. So add each project separately, then add the root dir.

Re:HTTP/3: Everything you need to know about the next-genera... by linkdd on Sunday February 13, 2022 @04:04AM (#30320401)
Unpractical for me, my "devel" folder is organized as follow:

  |-+ orga (github, gitlab, other)
  | |-+ domain (infra, business, research, ...)
  | | |-+ repo-name
VS Code do not support hierarchies of projects in a workspace, so I would just have a huge list of `project-name` where project-name would be manually renamed to `orga/domain/repo-name`.
Re:HTTP/3: Everything you need to know about the next-genera... by serverholic on Saturday February 12, 2022 @07:39PM (#30317884)
Not the same person but I share his sentiment. Go is terribly designed from a language perspective. It's weird and doesn't follow normal language conventions. The tooling and package manager is terrible.

Eventually I think it'll be seen as the next PHP. A language that people love to hate.

Re:HTTP/3: Everything you need to know about the next-genera... by linkdd on Saturday February 12, 2022 @07:46PM (#30317933)
I think the only reason Go was adopted is because Google was behind and pushing it.

But the result is that today, the ecosystem is huge. Implementing a kubectl plugin in Go is far easier than in other languages. Many things are in fact simpler with Go thanks to its vast stdlib and ecosystem.

I hate it, and yet... It's still useful to me.

Re:HTTP/3: Everything you need to know about the next-genera... by dotancohen on Sunday February 13, 2022 @02:43AM (#30320020)
Go is terrific for multithreaded apps. Or multithreaded scripts. But if I know that I'm going to be running everything in a single thread I wouldn't even consider Go.
Re:HTTP/3: Everything you need to know about the next-genera... by Gwypaas on Sunday February 13, 2022 @07:06AM (#30321175)
I would say it works as long as you don't need any major coordination outside of a few channels. As soon as you get into mutex territory you happily end up shooting yourself in the foot hoping that go test -race caught the bug someone else introduced. Or you spend unnecessary time implementing some concurrent safe type trying to hide the synchronization behind a pretty interface.

At work we have a split code base between rust and go, using go to interface with the world due to better ecosystem while using rust for the heavy lifting of business logic in an extremely concurrent implementation.

Even though the rust side is more complex it is much easier to work with and refactor leading to fewer bugs. The language simply gives so much for free, when you get over the first humps of a slow start.

The Rust cycle of 1. make it work, 2. handle errors, 3. encode invariants in the type system to prevent inadvertent refactors is simply magical.

Re:HTTP/3: Everything you need to know about the next-genera... by dotancohen on Sunday February 13, 2022 @07:26AM (#30321257)

  > The language simply gives so much for free
Are we familiar with the same Rust? Though I've only looked at it briefly about two years ago (beginning of pandemic), I don't remember getting much "free" with the language. Especially not coming from a "batteries included" Python background. I would honestly love to know what you feel that Rust provides out of the box. I'm very likely to use it in the future and such a head start may be valuable.

  > The Rust cycle of 1. make it work, 2. handle errors, 3. encode invariants in the type system to prevent inadvertent refactors is simply magical.
Isn't that the workflow of any minimum viable product development paradigm?
Re:HTTP/3: Everything you need to know about the next-genera... by Gwypaas on Sunday February 13, 2022 @07:59AM (#30321452)
I think we are looking at it with two different views of "free". It is not batteries included outside of synchronization, string operations, collections and iterators. We are using the Tokio ecosystem which has some nice batteries included.

My view of "free" in the comment is correctness. Concurrent code simply keeps on working through refactors to suit the business needs. Most of the time the tests pass the first time the code compiles again after a refactor of core pieces. That is something I haven't experienced in any other language. I simply do not feel scared touching, changing or removing anything to get the most lean code base possible.

Compare this to Python where I want to have the mental model of the entire "world" for every change I do and then simply hope that the tests will catch any errors. Go is better when kept simple, but still a lot of implicitness and conventions leading to easy shooting yourself in the foot.

> Isn't that the workflow of any minimum viable product development paradigm?

Definitely, Rust simply gives more tools for it. For example through sum types and traits to enforce invariants. Say comparing to the awful iota hacks to get "enums" in Go, accidentally having a meaningful default value or run time verification because somewhere you ended up with an interface{}.

In rust for the "make it work stage" simply throw expects everywhere and choose to panic on errors, or just bubble to the top without caring. It never silently simply works unless you've explicitly chosen how to deal with the possibilities which is very reassuring.

Go has some of that feel, but actually doing something useful with errors more than logging I have never seen a good paradigm for yet. Errors as/is kind of works but still puts most of the work on the user to figure out the correct thing. Maybe I haven't dove deep enough though.

For some info on how far you can take error handling in Rust forcing correctness on the users see this blog post from Sled (an embedded KV database) http://sled.rs/errors.html

Re:HTTP/3: Everything you need to know about the next-genera... by dotancohen on Sunday February 13, 2022 @09:45AM (#30322018)
Thanks, I've yet heard of Tokio, I'll save that and the Sled article in my rust.org file.

Interestingly, the example code on the Tokio github page use the antipattern described in the Sled article, regarding the try operator.

Re:HTTP/3: Everything you need to know about the next-genera... by linkdd on Sunday February 13, 2022 @03:15AM (#30320164)
> Go is terrific for multithreaded apps.

Yes, true. But so is Erlang/Elixir.

Re:HTTP/3: Everything you need to know about the next-genera... by dotancohen on Sunday February 13, 2022 @04:23AM (#30320479)
Thank you. I've never used Erlang though I understand that it's philosophy is well suited to high-uptime applications such as servers, which I do work on. I will definitely give it a test drive.
Re:HTTP/3: Everything you need to know about the next-genera... by eyelidlessness on Saturday February 12, 2022 @07:45PM (#30317927)
I haven’t written any Go, but having read through some tutorials I find this a little hard to believe. Besides, Node has already been the next PHP, in terms of reputation and ridicule, for almost its entire lifespan. I do expect Go will become more esoteric over time, but mostly because it’s a Google thing (with all the unpredictability that implies), and because it overlaps a couple rapidly evolving use case targets.
Re:HTTP/3: Everything you need to know about the next-genera... by azurelake on Saturday February 12, 2022 @08:19PM (#30318155)
It's not. For the niche it has found success in (infra type backend stuff), it's by far the best option available. `if err != nil` is a godsend in that world.
Re:HTTP/3: Everything you need to know about the next-genera... by ciupicri on Saturday February 12, 2022 @09:08PM (#30318433)
What's so great about `if err != nil` ?
Re:HTTP/3: Everything you need to know about the next-genera... by linkdd on Saturday February 12, 2022 @09:12PM (#30318459)
In theory: explicit error handling.

An error should be taken care of immediately, or propagated with some additional context. Returning the error instead of throw/catch makes this explicit and forces the developer to think about it.

In practice: a lot of boilerplate code.

Rust does this better with the Result type and the ? operator.

Re:HTTP/3: Everything you need to know about the next-genera... by eyelidlessness on Saturday February 12, 2022 @09:38PM (#30318587)
From a pragmatic perspective, the theoretical advantage is real (typed exceptions are better than not having them, just as explicit nullables are better than implicit). Theoretically Result and Option are just recognized names, which I don’t mean to discount but they’re effectively union types with pattern recognition privileges.
Re:HTTP/3: Everything you need to know about the next-genera... by dmitshur on Saturday February 12, 2022 @10:04PM (#30318727)
I like the “opportunity for correction” and “code proportionality” points brought up in https://medium.com/@shazow/code-boilerplate-is-it-always-bad....
Re:HTTP/3: Everything you need to know about the next-genera... by eloisius on Saturday February 12, 2022 @08:51PM (#30318335)
> It's weird and doesn't follow normal language conventions

Maybe this is a key ingredient in successful languages. Just warty and anachronistic enough that users learn a lot of unique patterns that keep them glued to the language.

Re:HTTP/3: Everything you need to know about the next-genera... by pirate787 on Saturday February 12, 2022 @08:18PM (#30318145)
PHP powers a vast part of the web ecosystem, is far more accessible to learn and deploy than Go, and the language is greatly improved and even loved by many.