Go Experiments Explained(alexedwards.net) |
Go Experiments Explained(alexedwards.net) |
I want to learn Go.
If an oldie like me can learn go well so can you
I am thinking of making a CLI scoundrel card game.
From what I understand, it’s not default because there are performance regressions in some edge cases. But the typical performance is much better and the API is also much better.
To anyone writing new code that does anything with JSON—turn it on. Use it. I think it will be on by default soon enough anyway (1.27).
Combined with typed fat pointers (slices and strings), typed hashmaps and stack-trace-assertions, C in general becomes quite nice. The rest is compiler flags.
Go solves this by being a better language out of the box, but with the Wirthian aspects removed they feel very similar. Perhaps not so surprising.
Arenas are great for avoiding allocations per tick/request/frame/layer. No symmetric free() to bracket lifetimes! They have a purpose, and we always knew that.
But by definition, your program is over-allocating as a tradeoff. Makes a ton of sense in certain use cases. However, we didn’t invent garbage collection and borrow-checking and realloc() just to publish papers ;)
Half of my time programming zig is spent considering allocation strategies. That’s a feature. “Where are the bytes?”
So, maybe we could also have allocator bubbles, where code running inside the bubble is just as allocator-naive as any other Go code, but when it allocates (make/new/pointer escape), it uses the bubble's allocator instead of the default one.
The big problem I can think of, though, which doesn't apply to time bubbles, would be that pointers drawn from that allocator might escape the bubble (e.g. by assigning them to a longer-lived struct field). It's possibly something that can be detected by the runtime, but because the API is non-invasive by design, it's not something that will be apparent to the programmer when looking at the code.
Go remains my favorite language for the tooling alone (while not forgetting about so many other great features)
Go‘s github discussions on the other hand, give me live-view of the latest state of the experiment. I find both useful and don‘t prefer either.
If I can do this, anyone can. I believe in you internet friend. In tech, every day’s a school. Embrace it and learn something new daily, or get left behind. You’ve got this
This is Go (golang). It’s not even the same language used in the development of Chrome.
And the reason I make the distinction between feature flags and this is because some of the “experiments” discussed in the article are new packages / modules. So you’re not changing compiler behaviour via a flag or env var. You’re just importing a new package that isn’t yet considered stable.
And I'm pretty sure that their example is that importing "encoding/json/v2" doesn't work until you tell the compiler to enable it via environment variable.
You'd think that, but you'd be wrong. Parts of Google can and do things their way. There's not an all-encompassing "Google way". And even if there was one, the Go team is notoriously doing things its own way.
I assume you’ve got experience in the subject you’ve got an opinion on?