Re:A New Go API for JSON
by lolpanda on Wednesday November 04, 2026 @01:42PM
(#50369779)
the marshal api has been very annoying. why does marshal return an error? the only reason the marshal can return an error is that the input type is not marshalable. it's certainly a code bug. to me it's like int+str returning an error instead of compiler error
Re:A New Go API for JSON
by hnlmorg on Wednesday November 04, 2026 @02:19PM
(#50370265)
This isn’t a type system problem. It’s a data origin problem. Ie it could be any random JSON blob a user entered. The compiler doesn’t know this ahead of time.
If you wanted type safety with JSON in Go then don’t use the marshal interface. Period.
Re:A New Go API for JSON
by thayne on Wednesday November 04, 2026 @02:51PM
(#50370622)
For unmarshalling, but the original complaint was about marshalling. And for that the type system could help if the marshal API only allowed you to marshal objects of types that supported marshalling.
Re:A New Go API for JSON
by hnlmorg on Wednesday November 04, 2026 @03:05PM
(#50370779)
I’d already addressed that when I said the marshal API is an interface that’s meant to be reusable across generalise use cases. it can be used for a variety of data formats and not just JSON.
Go has this concept baked into the language. For example read and write interfaces so you can write data to an endpoint without having to worry about whether it’s a file system object, TCP/UDP socket, gzip achieve, and a plethora of other options too.
It’s a nice convenience feature and makes up considerably for the restrictions that the Go type system places.
And if you need higher performance code, or compile time safety, or have any other constraints that limit your ability to use these generalised interfaces, then you can use different APIs from the Go standard library to achieve the same thing.
You don’t need to call json.Marshal() if you don’t want to. It’s an option, but it’s just one API into the JSON toolbox.
Re:A New Go API for JSON
by thayne on Wednesday November 04, 2026 @04:07PM
(#50371540)
First of all, the json2 Marshall API is json specific.
Secondly, other languages like rust, haskell, scala, etc. Have json APIs that are typesafe and give you compile time errors if you try to use a type that doesn't support (de) serialization . In the case of rust at least, the API is also general and can be used for other data types as well.
Even in go, you could have some more type safety if Marshall took an interface (such as MarshallerTo) rather than `any`. Although then you have the problem of how you implement that interface. So I guess you probably want some kind of "derive" functionality, or macros that can approximate it for a convenient and type-safe API.
P.S. gophers like to talk about how explicit being better than implicit, but using reflection for marshalling is very implicit.
Re:A New Go API for JSON
by hnlmorg on Thursday November 05, 2026 @02:11AM
(#50376101)
Except it’s not JSON specific. The article literally talks about how their function design was chosen for similarity with the v1 API. And I’d wager that the go team are planning on reusing that function signature for other encoders too. Or at least expecting it to be reused by the wider ecosystem.
If you want type safety then pass a struct to the marshal. Which is actually the idiomatic way to do it anyway. The type safety would be in that.
I’m not going to disagree with you that Gos type system is a rather blunt tool nor that Gos expressiveness is extremely rigid compared to many other popular languages. All of that is completely true. But I don’t agree that the v2 JSON API is a good example of that problem.
Re:A New Go API for JSON
by thayne on Thursday November 05, 2026 @01:56PM
(#50382917)
> Except it’s not JSON specific.
The function is in the `encoding/json/v2` package. It might have a similar design, and maybe they will use the same function signature for other encoders, but it the functions are very much json specific.
> If you want type safety then pass a struct to the marshal.
But if you use a struct that has a field that can't be marshalled, you don't get a compile error, you get a runtime SemanticError. That's the problem.
Re:A New Go API for JSON
by hnlmorg on Thursday November 05, 2026 @04:01PM
(#50384410)
> The function is in the `encoding/json/v2` package. It might have a similar design, and maybe they will use the same function signature for other encoders, but it the functions are very much json specific.
But the point you keep missing is that the function signature needs to be encoder agnostic for it to work as an interface.
> But if you use a struct that has a field that can't be marshalled, you don't get a compile error, you get a runtime SemanticError. That's the problem.
Re:A New Go API for JSON
by thayne on Friday November 06, 2026 @02:47AM
(#50389366)
> But the point you keep missing is that the function signature needs to be encoder agnostic for it to work as an interface.
It's a function, not a method. So it can't be part of an interface.
I suppose you could make an argument for passing it as a function argument to a higher ordered function. But that is kind of an unusual way to use such a function. And isn't a common pattern in go.
> My point here was: if you know you’re creating a struct to pass to the mashaller at compile time, then you’re already going to use JSONAble fields. So it’s not an issue.
Maybe. Maybe not. For a simple struct where all the fields are primitive types sure. But if you have a complicated hierarchy, you might miss that some strict in the hierarchy has a field that can't be marshaled.
Say you are marshaling a struct that contains a struct from a third party library, and it works fine. Then you update to a new version of that library, and that added a new field for a type that doesn't work, say a map[A]string where A is a struct. Your program still compiles fine, but then you get an error at runtime when you try to serialize something that worked before. Hopefully you have tests that catch it.
Re:A New Go API for JSON
by hnlmorg on Friday November 06, 2026 @04:00AM
(#50389878)
> It's a function, not a method. So it can't be part of an interface.
The mashaller here is a function, yes. But having a consistent signature means you can interchange those marshallers. It’s a trick I use heavily in murex to enable typed pipelines.
And I do this via a pipe interface. So it’s not uncommon to reuse function signatures for interface types (fewer runtime abstractions) while retaining some level of dynamism.
> Say you are marshaling a struct that contains a struct from a third party library, and it works fine. Then you update to a new version of that library, and that added a new field for a type that doesn't work, say a map[A]string where A is a struct.
The first mistake there is to blindly forward an API struct that you don’t control and depend on that for business logic.
Which comes back to my point about if you want type safety then you’d create a struct.
I do take your point that the compiler in smarter languages would catch this. But you’d equally be told not to do this sort of thing on those languages too.
Re:A New Go API for JSON
by awesome_dude on Wednesday November 04, 2026 @06:48PM
(#50373044)
I'm confused by this - you're saying that a "type system" would address this, even though there are two (incompatible) type systems at play here - Go's and JSON's
Compile time cannot check for runtime values (not even in Rust) - is your position that fields can only be populated at compile time?
Re:A New Go API for JSON
by thayne on Wednesday November 04, 2026 @11:32PM
(#50375214)
In go, the Marshall and unmarshal functions take `any` for the source or destination. If you use a value of a type that doesn't support marshaling or unmarshalling (say because it contains an unserializable type like a channel, function pointer, etc) then you get a runtime error. Whereas in rust, Haskell, scala, etc. you can get a compile time error if you try to use a type that doesn't support serialization.
Re:A New Go API for JSON
by thayne on Friday November 06, 2026 @02:21AM
(#50389219)
That just shows there are pointer values that can be marshaled, not that all such values won't error. If you have a non-nil pointer that points to an object that transitively contains one of the unsupported types, you will get an error.
Re:A New Go API for JSON
by thayne on Friday November 06, 2026 @01:17PM
(#50396120)
I'm not sure how you are getting that from "otherwise it is the recursively JSON-encoded representation of the underlying value", but here is a playground example, where using a non-nil pointer to a channel produces an error:
https://go.dev/play/p/JXYuGUQ0TLQ
Re:A New Go API for JSON
by iaaan on Wednesday November 04, 2026 @02:24PM
(#50370319)
It is trivial to ignore an error in Go if you know your use case cannot result in one. But at the end of the day, json.Marshal takes an `any` as a parameter, so it must return an error.
Re:A New Go API for JSON
by lolpanda on Wednesday November 04, 2026 @02:37PM
(#50370471)
i meant i hoped it's panic as opposed to return an error. if there was an error, how am i supposed to handle it? can i tell the user hey sorry my bad it's likely a code error? crash is better than possible eating the error siliently
I generally like `encoding/json/v2` and I'm glad they did it.
I wish they'd left `MarshalIndent` in there though. The equivalent code is super complicated and non-obvious, so it's a pain to migrate, and it's a pain when you're banging out some quick code and want to dump some readable JSON. I suppose these days the LLMs can write the complicated version for us, of course.
Re:A New Go API for JSON
by modulovalue on Wednesday November 04, 2026 @02:37PM
(#50370463)
I'm working on better SIMD support in Dart and one of the motivations for that work is specializing parser specifications based on schema specifications of that language.
Or more concretely, if we had a parser generator + json parser specification that can generate efficient simdjson style parsers, then we should be able to parse json restricted to a subset of json based on a schema at least as efficiently as simdjson can parse general purpose json.
That way we could have the best of both worlds, a (potentially lazy) statically type-safe model and simdjson performance!
I still think that this is definitely doable, it's just that a lot of infrastructure needs to be built for it.
I remember reading that Meta is doing something similar with binary formats. I find it weird that there's nothing like that for json yet.
Re:A New Go API for JSON
by weitendorf on Wednesday November 04, 2026 @03:05PM
(#50370783)
I was working on metaparsing earlier this year (specifically over grpc because of its better support for types and better serialization format).
I think most people who use JSON don't want strong typing or to use schemas. If you do, you just use a different serialization format: JSON is designed to be a generic, human-readable way to basically represent any kind of data structure (since it deserializes to JS objects). So everything about JSON is working against you if you do try to enforce type/schemas on it.
A grpc-like protocol with more prescriptive type registries/discovery (over the network) and better interop with http (like grpc-gateway) would be the best approach IMO. Definitely not JSON schema
Re:A New Go API for JSON
by thayne on Wednesday November 04, 2026 @04:45PM
(#50371997)
> I think most people who use JSON don't want strong typing or to use schemas.
Not necessarily. It's biggest advantage is probably that it has very good interoperability. Basically every language has a readily accessible library for json, and even if you don't, it isn't that hard to write a parser and/or generator for it. And being human readable isn't something to sneeze at either.
Re:A New Go API for JSON
by tcfhgj on Thursday November 05, 2026 @05:48AM
(#50377635)
> think most people who use JSON don't want strong typing or to use schemas. If you do, you just use a different serialization format: JSON is designed to be a generic, human-readable way to basically represent any kind of data structure (since it deserializes to JS objects). So everything about JSON is working against you if you do try to enforce type/schemas on it.
I have been using serde without issues, and never resorted to `serde::Value`[0], the untyped option, so far.
I have yet to experience anything working against me.
Re:A New Go API for JSON
by dankobgd on Thursday November 05, 2026 @06:06AM
(#50377756)
I definitely want jsonschema, it's a standard and i can use it for many tools.
openapi spec is also a standard and built on top of jsonschema. I can use jsonschema to generate models, types, servers, client sdks, automate forms etc.
I think it's better than grpc for some of these things, plus protobufs and grpc have bunch of tooling that i can pretend to understand but in depth i don't really.
Re:A New Go API for JSON
by tclancy on Thursday November 05, 2026 @07:05AM
(#50378158)
I think it may be fairer to say, “most people pick up JSON because of the flexibility.” Those who continue to use it for anything where there’s a consumer of your API probably do come to want types. In my day job I am starting to enforce end-to-end typing as best I can (given it’s Python and JSON) because our payloads are partially content from agents and I want to be able to flag up weird shit if we can. Certainly not the only gate that we have for looking for prompt injection and not even a great one, but it provides some piece of mind.
Re:A New Go API for JSON
by gwbas1c on Thursday November 05, 2026 @09:35AM
(#50379592)
> I think most people who use JSON don't want strong typing or to use schemas.
Pretty much anywhere I've come across JSON (and xml before that,) everyone expected strong typing. The fact that JSON (and xml) can represent different data than they anticipated "did not compute" in their heads.
In many cases, they were treating JSON (and xml) as dumb serializers and not even paying attention to the output and corner cases.
Re:A New Go API for JSON
by asim on Wednesday November 04, 2026 @02:40PM
(#50370500)
At this stage to me Go is the new C compiler. Quite honestly I spent 10 years or more writing Go code. At times 18 hours a day. And now with AI, I get models to write my Go code. I STILL want it to be Go code. Is that strange? No because I understand the performance and safety of Go. But I rarely write it directly anymore. Probably not at all in 6-9 months. Yet I still occasionally look at the code to see what the output looks like.
So yea hopefully a nice new addition but only my prompts now matter. So need to make sure they pickup on the new API.
Re:A New Go API for JSON
by dofm on Wednesday November 04, 2026 @03:38PM
(#50371174)
Yes. It's that thing — the fact that a language helps you read what a single function does really easily, but in so doing makes the entire codebase quite dense, is not optimal for us, but is good for them.
And the things that we do to manage this, that are symbolic or based on visceral real-world analogy, are good for us and bad for them.
Go is kind of in the middle, in the way that many vaguely Wirth-like and CSP-like languages possibly are, I guess.
Re:A New Go API for JSON
by citizenpaul on Wednesday November 04, 2026 @03:26PM
(#50371017)
People are sleeping on Go as a LLM language of choice. Everyone trying to rewrite in rust which is fine and rust is fine. However its compile times are several orders of magnitude greater than Go. You can have LLMs write and compile 20 apps in the time one rust app compiles. I've got a Go personal project that would take hours for rust to compile, I can't imagine making the same velocity in Rust. Though I do see the workplace appeal of bringing back the xkcd "compiling" meme.
However it kind of makes me feel like my professional life was wasted and I don't really know what kind of future I have. One of Go's main points was you can pick it up in a weekend. What career moat do people like us have?
Re:A New Go API for JSON
by pjmlp on Wednesday November 04, 2026 @04:16PM
(#50371653)
That is fighting the last war on the early days of 5 GLs, and taken care by agentic runtimes.
This isn't futurology, besides a few projects that already came up on Phoronix and around here, with Assembly generation, there are enough SIGPLAN papers on ML driven compilers already.
Re:A New Go API for JSON
by bayindirh on Thursday November 05, 2026 @04:57AM
(#50377297)
ML driven compilers are different than LLM assembly generation, and former is more sound than the latter one. I believe we both have enough experience to understand that.
However, starting with LLMs directly generating machine code and moving to ML directed optimization passes, you're moving the whole stadium with a crawler-transporter, not only the goalposts.
Helping compiler in a well defined way, and working on IR or driving it repeatedly to optimize the output is one thing, generating machine code from a training set is other. Let's not mix them.
There are other researchers if you interest yourself on the matter.
Then the whole iPaaS agentic coding environments like Workato and Boomi, that even if they might generate 3GL as intermediate step, you don't get to see it.
Re:A New Go API for JSON
by kibwen on Wednesday November 04, 2026 @09:24PM
(#50374319)
This is like saying that a strong man would rather dig a hole by hand than use a shovel. Programming languages are force multipliers, it makes absolutely no sense to bypass them just so you can vibe assembly directly.
Re:A New Go API for JSON
by kibwen on Tuesday November 10, 2026 @05:47PM
(#50447376)
> I am already using a bagger, while you are arguing for electric shovels.
This demonstrates that you continue to misunderstand the analogy.
Let's speak plainly. Someone who attempts to use LLMs to generate assembly directly will be outcompeted by someone who uses LLMs to generate code in a high-level language, which then uses an ordinary compiler to generate assembly. The value of a high-level language is that it defines a more constrained abstract machine than the machine that a CPU represents, which both humans and LLMs alike benefit from.
Re:A New Go API for JSON
by dgb23 on Thursday November 05, 2026 @05:06AM
(#50377355)
One of the best techniques for using LLM coding is to let it write programs that frontload and automate work in a repeatable and testable manner rather than letting it only do free form turns.
Letting it generate machine code directly would be the opposite of that.
Re:A New Go API for JSON
by xarope on Thursday November 05, 2026 @02:37AM
(#50376274)
isn't that one of TinyGo's raison d'etre's? I've never tried wasm, but executables are typically a magnitude smaller than go's (assuming your go code is compatible with tinygo, of course)
Re:A New Go API for JSON
by jimbob45 on Wednesday November 04, 2026 @05:00PM
(#50372154)
If I want simplicity and maintainability, I’d pick Kotlin over Go. If I want speed, I’m picking Rust over Go. Why would I ever pick Go? It’s the best at nothing.
It's really great fun to build stuff in Crystal, I don't have anything prod-grade yet to say how it scores there but the community seems to be happy about that too.
Re:A New Go API for JSON
by alexfortin on Thursday November 05, 2026 @01:26AM
(#50375867)
I agree, the compiler is slow but I don't mind much, or better, the fact that I find building maintainable programs much easier outweights that downside massively in my case.
Re:A New Go API for JSON
by jimbokun on Wednesday November 04, 2026 @10:59PM
(#50374996)
It always feels like OCaml is on the verge of becoming the perfect language.
Expressive and type safety of a functional language, without the odd semantics of Haskell, where laziness can make performance difficult to predict and purity can make simple things like IO difficult to understand.
Re:A New Go API for JSON
by Vaushite on Wednesday November 04, 2026 @11:15PM
(#50375103)
Efficient code means code with a large amount of embedded assumptions. Code that's more generic is almost always less efficient.
Go is about as far as you can "go" to the efficiency end without becoming Rust. It's a low-overhead language (like C) but with a GC that ensures memory safety. If you want to manage memory yourself and still prove safety it gets very complicated, as we see in Rust.
Re:A New Go API for JSON
by biztos on Wednesday November 04, 2026 @03:54PM
(#50371362)
As I do more agentic coding, I am starting to feel strongly that I need to set aside a project -- and time -- for strictly hand-coding, using AI (if at all) only to explain things, never to write any code.
First, I like programming and don't want to stop doing it just because a machine can do it too. Second, I'm pretty sure atrophied coding skills will make me worse at directing the machines, thus worse at what seems to be "the job" these days.
Re:A New Go API for JSON
by nonethewiser on Wednesday November 04, 2026 @04:09PM
(#50371552)
>First, I like programming and don't want to stop doing it just because a machine can do it too. Second, I'm pretty sure atrophied coding skills will make me worse at directing the machines, thus worse at what seems to be "the job" these days.
In theory wouldn’t atrophied coding skills not matter if models are sufficiently good at coding? I mean isn’t whats left just design and architecture and testing?
Sure, if LLMs are producing shit code you need to have an understanding of what it should do instead. But I think that day is already gone.
Its hard to think of a skill that you’d need to build with an LLM that requires writing meaningful amounts of code by oneself. From my end all the complexity is business logic and system design.
Re:A New Go API for JSON
by nonethewiser on Wednesday November 04, 2026 @05:07PM
(#50372205)
Read my comment again. And the one I replied to. He claimed that his ability to code through LLMs has decreased as his coding ability atrophied. Im not questioning coding for the love of the game.
Re:A New Go API for JSON
by biztos on Saturday November 07, 2026 @12:28AM
(#50401914)
> He claimed that his ability to code through LLMs has decreased as his coding ability atrophied.
No, I didn't. I claimed that if my coding ability atrophies, I expect that my ability to code through LLMs will decrease. And this is an outcome I want to avoid for the stated reasons and others.
That said, I get your point: maybe "the thing writing the code" will be as abstract as "the thing moving the electricity through transistors" at some point. And maybe I will be wrong about coding skill translating to good agent-herding skill. But I don't think I'm wrong now.
Re:A New Go API for JSON
by nonethewiser on Wednesday November 04, 2026 @06:42PM
(#50372999)
>No, because good understanding of design comes from programming experience.
“Programming” is a bit loaded. Do you mean thinking through and typing everything out yourself?
What design skills specifically can you only develop from continually programming in this way?
Personally I’ve found the opposite to be true. As writing out code myself has shrank to nearly 0, I now have a much shorter feedback loop on design. You get a lot more repetition and feedback when that’s basically all you are doing.
Re:A New Go API for JSON
by skydhash on Wednesday November 04, 2026 @09:34PM
(#50374403)
> seeing feedback on your design in minutes rather than weeks or even months.
Weeks and month for to wait for a feedback in developing software? Are you the sloth in zootopia?
The longest cycle for feedback for me has only been hours. And that was about redesigning the core architecture of an app. Otherwise, it’s like 10 minutes cycle if it’s edit-compile-run, 5 minutes if it’s REPL (lisp, bash, python,…).
Re:A New Go API for JSON
by Mawr on Thursday November 05, 2026 @04:13AM
(#50376962)
> What design skills specifically can you only develop from continually programming in this way?
As I write code myself I continously take into consideration stuff like following the consistency of the entire design, whether what I'm doing is efficient, etc. LLMs are terrible at this and I don't see how you could develop such skills by prompting only.
For example, I would never produce designs that require degenerate db access patterns (linear scans, etc.). Everything I write myself always takes into account using db & network efficiently from the ground-up. Every query is an index lookup, every api request is rate limited, everything is batched and cached, so on and so forth.
LLMs meanwhile don't care about any of this. I just had Claude happily try to fetch youtube page html because the api didn't expose something. Great idea, I'd love to be banned by google for scraping.
Designing with performance in mind is black magic too, I need to notice myself that stuff that I think has no reason to be slow (pretty much nothing does) is slow and hammering the llm to finally come up with a non-stupid design that's not ridiculously slow and wasteful. Yeah, why don't we pull 2.3mb of html to update a list, sounds good.
Re:A New Go API for JSON
by nilamo on Wednesday November 04, 2026 @04:47PM
(#50372017)
I haven't actually tried it yet, but I think it'd be good to write a dsl for whatever you're doing. Then have ai make an interpreter to run it. Sort of as a way to stay... interested? Engaged?
Re:A New Go API for JSON
by queenkjuul on Wednesday November 04, 2026 @10:31PM
(#50374796)
That's exactly how i do all my personal projects. No agents, AI just for planning/research/debugging and occasionally for small bits of code i am not super interested in. For example I'm currently working in Go, but need to use a C library, and don't know C much at all. So when i get stuck with the C interop parts, sometimes i let the AI write bits of C for me, or let it write scripts for cross-compiling or other stuff i just find to be a pain. But I'm doing all the writing and logic myself.
Agents make it too easy to gloss over too much. They're great at work where i care about productivity but I've zero interest at home where the point is learning and having fun
Re:A New Go API for JSON
by lkirkwood on Thursday November 05, 2026 @12:29AM
(#50375565)
Do it! I have the same feeling and the hardest part is picking something that you are interested in. I have just kept the idea of "thinking of ideas" on my mind for a few days once I finish something. I usually come up with a few ideas if I'm always considering any little thing for a project. It has been fun and I have learned a few things along the way - more than I feel I do letting AI write most of the code.
Re:A New Go API for JSON
by jacobgold on Wednesday November 04, 2026 @03:57PM
(#50371415)
I still prefer Go over the alternatives because I'm reviewing the code carefully and trying to make it all look as good as if I'd written it very carefully by hand.
The few times I've needed a language without a GC and used Rust and C as target languages, I've reviewed the code less and enjoyed it less.
Re:A New Go API for JSON
by pjmlp on Thursday November 05, 2026 @05:16AM
(#50377423)
JVM and .NET platforms.
JIT and AOT compilers, REPL development, bleeding edge GC implementations, Java, Scala, Kotlin, Clojure, C#, F# to chose from, and modern IDEs inspired by Smalltalk/Lisp Machines experience, batteries included backed and frontend development frameworks.
Re:A New Go API for JSON
by TheDong on Thursday November 05, 2026 @03:41AM
(#50376734)
I do personally find myself most productive with a cycle of 20 hours awake / 12 hours asleep. Circadian rhythms vary by person.
Unfortunately, the world makes it hard to keep that cycle, and so instead I mostly do 17 hours awake / 7 asleep, which makes me feel constantly tired (though less tired than 16/8 at least).
Re:A New Go API for JSON
by vikramkr on Thursday November 05, 2026 @04:15PM
(#50384551)
Im not saying this is what's happening here, it could totally be just that he was burning himself out at work, but it's a truly incredible thing to find something that you love working on and want to dive into to the point that you lose hours at it and have to pull yourself away from it to go to sleep (obviously outside of stuff designed to be addictive and exploitative like gambling that hijack those reward mechanisms). Programming is one of those artistic technical pursuits and a lot of programmers love it in that way. And are grieving losing that with A. At least so far as you felt you could only justify spending time on something you loved like that if you were also paid for it. Nobody is stopping you from opening up a text editor again on your own time. But you know, it's good to be passionate about things. Not being able to sleep until you figure something out, losing track of time while you're lost in whatever you're working in - all that stuff where it's from innate drive and the love of the game? that stuff rules. If it's burnout throw it out but don't throw out the electric stuff that makes us human
Re:A New Go API for JSON
by asim on Thursday November 05, 2026 @01:41AM
(#50375939)
No not a brag. I haven't done this in a long time. It's really unhealthy but I was trying to get a startup off the ground and became obsessed. Don't recommend it.
Re:A New Go API for JSON
by dofm on Wednesday November 04, 2026 @02:41PM
(#50370505)
I… think this is good?
I'm just getting the neuron-band back together where Golang is concerned. I have done some in the past for little system tasks, but I am switching away from interpreted languages entirely for web stuff, and initially to Go, as I switch away from hand-coding to at least LLM-supported coding.
So I am a bit out of date on the pain points (I never really felt pain points when I last used it, because the jobs I was doing had very small, quite Go-friendly shapes).
Re:A New Go API for JSON
by cbarrick on Wednesday November 04, 2026 @02:52PM
(#50370631)
The fact that this took 6 years to land stood out to me.
I'm not entirely surprised, and I'm glad the Go team is carefully considering their interfaces before launching. But 6 years seems like a lot of work to land a JSON API.
Re:A New Go API for JSON
by hnlmorg on Wednesday November 04, 2026 @03:14PM
(#50370883)
I think in the case of JSON, it was “good enough”. People who found this to be a problem would use one of the many 3rd party options.
I kind of like that the standard library doesn’t move fast. It makes it easier to fit the ecosystem into my head (unlike, for example, the JavaScript ecosystem where I find code doesn’t survive 2 years before failing to compile).
But I do agree that slow and steady produces its own problems. Your example of generics is a good one. But think the example of Go modules is another, perhaps even better, example of how sometimes the Go team really should have accelerated their efforts on.
Re:A New Go API for JSON
by awesome_dude on Wednesday November 04, 2026 @05:31PM
(#50372400)
lol, I don't mean to be contrary, but I looked into dependency management (partly because of the modules implementation, partly because of early teething issues, and partly out of pure curiousity.
Dependency management is a freaking nightmare, nobody has managed to create something that is bulletproof, not cargo, npm, apt, yum, nix, homebrew, nothing.
The key issue is that you're managing 3rd party software that may or may not adhere to the prescribed lifecycle/versioning
The Linux variants do it by each having dedicated teams watching upstream sources, taking what they believe to be whatever they feel is right, building for their nominated target(s), then testing, before deploying (on top of that, all of these steps vary in importance and rigor depending on numerous variables)
For programming libraries (which is what depmod, goose, vgo, and modules are managing) it's just as bad, if not harder, because their very nature is to provide a base upon which other developers can turn into whatever their imagination.
Add to that, modules was (initially) written by people who were dealing with a slightly different ecosystem; Google rather famously has a monorepo, making their lives a little easier when it comes to managing dependencies.
So, with those things in mind, dependency management is always going to be a hard problem that is opinionated (eg. I have a firm opinion that there should be an easier way to "pin" a dependency, other than vendoring - note that this isn't an invitation to every junior Go developer to come and claim go.sum does that. It doesn't. go.sum is a log of what dependencies were used for the last build by whomever wrote to it)
Re:A New Go API for JSON
by hnlmorg on Thursday November 05, 2026 @01:55AM
(#50376002)
I’ve written package management tools so I disagree that dependency management is hard.
But my point was Go waited until there were multiple established 3rd party package management tools for Go already in widespread use before even releasing their own experimental implementation.
Their inaction caused far more disruption to the ecosystem because people got fed up of waiting, implemented their own, integrated it into their workflow and then had to reintegrate a whole new system all over again a year or two later.
Your point about Googles needs is the one often cited for Gos inaction. But I think that actually makes the situation worse. Because if the Go team cannot empathise with use cases outside of one bespoke enterprise, then it really shouldn’t be released as a general purpose language available for all to use.
And I say this as someone who generally likes the language.
Re:A New Go API for JSON
by Mawr on Thursday November 05, 2026 @03:43AM
(#50376756)
Interesting, I came to the opposite conclusions, but for the same reasons. I like that they waited to see what alternative proposals/implementations were out there before they decided on their own.
Especially since "Go team cannot empathise with use cases outside of one bespoke enterprise" — it shows self-awareness of their shorcomings. I think it's wise to let the target audience explore the design space themselves a bit first. Considerably lowers the risk of cementing the wrong design.
I do somewhat remember the drama around this at the time, but I my impression was that of a petulent community of various dependency management projects with too much ego attached to them to see the bigger, long-term picture.
Re:A New Go API for JSON
by win311fwg on Wednesday November 04, 2026 @03:28PM
(#50371060)
> generics (something that I still haven't used beyond the tutorials) took an age as well
Only about a year from when the Haskell guys lent their expertise and it landing in a release. That's actually fairly quick given that it was a pretty significant change under the hood and constrained by only two releases annually.
The Go team was always clear that they didn't have the necessary expertise internally and were relying on the open source community to lend a hand. Unfortunately, open source doesn't mean open willingness to contribute.
Before Featherweight Go, there was Featherweight Java.
So maybe a language designed in 2012 (v 1.0 release year), should learn from history instead of hand-waving it away as needless fluff.
> In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier.
And not all on the team were convinced, here Rob Pike,
> I think the transition to getting polymorphism into the language through generics is has still got some years to work through there's still things that don't quite work right
Re:A New Go API for JSON
by win311fwg on Thursday November 05, 2026 @05:01AM
(#50377327)
> instead of hand-waving it away as needless fluff.
If you go back and watch the original Go announcement it was made abundantly clear that they believed Go did need generics at the time but that they didn't have the expertise to do it. Yes it is true that the book was already written on it, but that doesn't mean anyone on the Go team was familiar with it or had the time to become familiar with it. Programming languages do not require gods to design them. Imperfect humans can too.
The experts on HN who know all the ins and outs of generics could have contributed but, you know, shitposting "go doesn't have generics lol" was apparently a better use of their time. But it is certainly not for anyone else to do decide how they live their life.
Re:A New Go API for JSON
by pjmlp on Thursday November 05, 2026 @05:07AM
(#50377362)
Gonuts is full of content that they were not keen in generics, in fact gccgo has been abandoned, and I expect it to eventually follow gcj and be removed from GCC.
Go culture is not welcoming to experts contributions, Rust, D, C#, Swift and others, heck even Java, are more open arms to language designers.
Re:A New Go API for JSON
by win311fwg on Thursday November 05, 2026 @05:13AM
(#50377397)
Nobody is keen about language features. Each new one adds complexity. That isn't the same as failing to recognize a need, though. And we know the Go team recognized the need as they clearly kept working on generics all the way from the very beginnings up until the Haskell muscle showed up. The receipts are clear and present. The results just weren't good, as one would expect from a team who weren't shy to say that they didn't have the expertise necessary.
You'd think one of the HN experts would have shown up to offer that expertise, but I guess there was a lot of "go doesn't have generics lol" to get out.
Re:A New Go API for JSON
by pjmlp on Thursday November 05, 2026 @07:37AM
(#50378383)
Some did try, and were welcomed with stones, clubs and pitchforks, until leadership had to reach out for help, from the same team that designed Java generics, years before Go v1.0 came to materialise.
The Haskell muscle had proven their skills already with Featherweight Java, in 2006.
Re:A New Go API for JSON
by win311fwg on Thursday November 05, 2026 @09:12AM
(#50379290)
The same people who were working on generics in Go prior to v1 were also still there to help out when it eventually landed, so whatever stones, clubs, and pitchforks you saw weren't compelling enough to scare one away from making it happen. Such things don't get in the way when do something is worthwhile.
But obviously "go doesn't have generics lol" comments were even more important. Imagine what would have happened to HN if that wasn't repeated multiple times daily for years!
Re:A New Go API for JSON
by win311fwg on Thursday November 05, 2026 @09:40AM
(#50379651)
And there was plenty of help given by others who also weren't experts. There was no lack of trying within a sea of incapable people. Unfortunately, that wasn't what the project needed. It already had a team full of blub developers, it being a language for them.
Re:A New Go API for JSON
by Philip-J-Fry on Wednesday November 04, 2026 @06:06PM
(#50372702)
For like 99% of use cases encoding/json was fine. Of course improvements are welcomed. But personally I've lead development of the backend of part one of the biggest sites of its kind in the world, and we just used encoding/json and net/http. Most of our use cases are just building APIs, client facing ones, internal ones, trusted third-parties. These systems have pretty high throughput, more than most people will ever work on.
Within our company I saw people in other teams writing their own optimised JSON libraries for whatever hellish reason. I always reiterated the point that as soon as that app made a single IO request all those nanosecond savings are invisible. Yes, it affects your total CPU time for processing a request but compute was never ever a limitation for us and it's likely not a limitation for most people. And if the trade off is your app needs scale slightly larger versus writing custom JSON code or pulling in a third party dependency, then I'm accepting the larger scaling.
The biggest benefit of encoding/json/v2 isn't the speed, it's the improved API.
Re:A New Go API for JSON
by hxtk on Wednesday November 04, 2026 @04:36PM
(#50371898)
In Go, it’s a question of who owns the allocation. If you return a pointer type allocated within the function, the answer is “no one,” so the pointer escapes and has to be managed by the garbage collector.
If the allocation is owned by the calling function which uses it internally and then doesn’t return it, it can be a stack variable. Or the same allocation can be reused many times in a loop. Or an array of allocations can be made all at once with foreknowledge of the total number.
If you pass a pointer into a function, the Go compiler can (and sometimes does) allocate it on the heap. Go has no allocation/ownership semantics, tragically, so the best we can do is depend on undefined behavior regarding the escape analyzer and hope the Go team doesn’t break it (which is a relatively safe assumption, considering that it’s unlikely that the Go team would start allocating things on the heap that were previously allocated on the stack—Go rarely regresses performance like this).
Re:A New Go API for JSON
by ahmedtd on Wednesday November 04, 2026 @05:34PM
(#50372436)
The parameters named "out" here are not "output parameters" in the way you seem to be thinking. They are "input parameters" named "out", because they are the buffer or pipe you want the data written to.
Re:A New Go API for JSON
by jayd16 on Wednesday November 04, 2026 @05:40PM
(#50372493)
`out` params in C# are params that must be set within the function. They are way to implement multiple return values and tell the caller "this is written to, not read from."
But you might be conflating that with in/out for Contra/Co-variance when specifying a generic.
Re:A New Go API for JSON
by travisd on Wednesday November 04, 2026 @04:30PM
(#50371845)
I think it'll bite some people, but probably is the better default for JSON specifically. Most of the nil-maps-become-null thing is just an extension of Go defaulting to nil for empty arrays and maps, which is usually not what you expect when you're writing a JSON schema like
type ListUsersResponse struct {
Users []User `json:"users"`
}
in Go. It's pretty common have code like
userRows := db.Query(...)
var users []api.User
for _, user := range userRows {
users = append(users, api.User{...})
}
where you don't _really_ intend for the default nil-ness to leak out. (Apologies for any broken syntax, I'm realizing in real time that it's been a while since I've written Go)
Re:A New Go API for JSON
by SkiFire13 on Thursday November 05, 2026 @01:16AM
(#50375815)
> Most of the nil-maps-become-null thing is just an extension of Go defaulting to nil for empty arrays and maps, which is usually not what you expect when you're writing a JSON schema
This is definitely not what I expect in other language. I would argue this is a quick of Go though and not JSON's fault.
How is this a broken default? In Go, I almost always want a nil slice to be treated exactly as an empty slice, and JSONv1 was the ~only place this didn’t work as expected, leading to frequent bugs.
Re:A New Go API for JSON
by c-hendricks on Thursday November 05, 2026 @09:52AM
(#50379813)
JSON often means data is crossing a boundary, and JSON has `null`. So if you have a PATCH endpoint that accepts a partial object, how do you determine what was actually set in the request vs what go has initialized to an empty value.
I don’t think there was a single canonical solution, but pointers to everything was a pretty common one. Everything in the AWS SDK was a `string` or a `float64` or similar—it was exceedingly annoying, not least of all because it basically forced tons of unnecessary allocations.
Re:A New Go API for JSON
by the_gipsy on Thursday November 05, 2026 @03:41AM
(#50376739)
The root cause is this idea of "zero values". Any de/serialization in go will always be crutchwork of guessing and incorrect validation.
Just look at the inane rules for map and slice access, what gets nil and what is panic. Even if that were consistent, then you'd still left to wonder if json.field was truly zero or not there.
Re:A New Go API for JSON
by Cthulhu_ on Monday November 09, 2026 @05:55AM
(#50423888)
Depends on whether they make it backwards-incompatible or they add methods alongside existing ones.
But that depends on whether they add monadic error handling in the first place, and if they do, if they intend to migrate the language's APIs to it - I don't think they would because the existing error handling is faster and everywhere.
Re:A New Go API for JSON
by kccqzy on Wednesday November 04, 2026 @05:51PM
(#50372575)
Some languages have a culture of doing things correctly and abiding strictly with the spec. These languages have indeed sorted it out years ago. Haskell for example. Any language that doesn’t have a special number type for JSON is imprecisely implementing the spec, because 1e10000000 is a perfectly valid JSON number that is beyond the typical IEEE754 implementation of floating point numbers; does your language handle that correctly? Haskell does.
Re:A New Go API for JSON
by layer8 on Wednesday November 04, 2026 @06:24PM
(#50372863)
The spec (RFC 8259) leaves various leeways to implementations:
A JSON parser MAY accept non-JSON forms or extensions.
An implementation may set limits on the size of texts that it accepts. An implementation may set limits on the maximum depth of nesting. An implementation may set limits on the range and precision of numbers. An implementation may set limits on the length and character contents of strings.
Re:A New Go API for JSON
by queenkjuul on Wednesday November 04, 2026 @10:43PM
(#50374880)
I don't get your argument here. You say Haskell conforms strictly to the spec and that's a good thing, okay. But then if the C spec allows for truncated names, a compiler could strictly follow the spec and truncate names. So strictly following the spec is not in fact the whole story
Re:A New Go API for JSON
by kccqzy on Wednesday November 04, 2026 @10:57PM
(#50374987)
Yeah very sorry for the confusion. I should not have used the word strictly. I explained my definition of strictly in the above comment and it’s not really strictly in the dictionary sense. I apologize for my bad writing.
Re:A New Go API for JSON
by layer8 on Thursday November 05, 2026 @07:19AM
(#50378233)
The thing is this goes both ways. For example, JSON with duplicate keys is valid JSON, and the standard specifies two ways to handle them. To support all ways JSON is used, an implementation will have to provide for both ways, and decide which one to pick as the default. The stricter default on the parsing side is at the same time the less interoperable one. Same for numeric precision: seamlessly allowing higher precision on the generating side lowers interoperability, while accepting it on the parsing side increases interoperability (but also places higher demands on the consuming application). So what do you do? There is no easy and simple answer.
Re:A New Go API for JSON
by thiht on Thursday November 05, 2026 @07:04AM
(#50378151)
It IS a simple format. And you can make a parser yourself very easily. Doesn’t mean that it will be the fastest or most memory efficient. Don’t confuse format and implementation
Re:A New Go API for JSON
by chabska on Thursday November 05, 2026 @09:44AM
(#50379709)
The spec itself is simple, but different libraries are written that optimize for different things: parsing speed, streaming parsing, minimal memory usage, very very large data, distributed storage, etc.
Re:A New Go API for JSON
by txomon on Wednesday November 04, 2026 @05:45PM
(#50372538)
I used the jsontext package at my company when we needed to make a parser for challenging clients (specific errors for each kind of mistake) while still keeping performance, and it works like a charm.
There is no introspection and speed is superb. I would definitely recommend jsontext as a parser for anything non-straightforward.
Re:A New Go API for JSON
by sneak on Thursday November 05, 2026 @05:35AM
(#50377540)
Any modern redesigned json library in 2026 should have at least a flag to serialize and unserialize json5. Sad that they had this opportunity here and blew it.
Re:A New Go API for JSON
by Mawr on Thursday November 05, 2026 @04:25AM
(#50377049)
Sure, if you ignore the massive difference in the rate such changes are happening at and that this new api is strictly better than the previous one, so there's no two ways that need to be decided between but rather the new go-to and the old-to-be-moved-away-from option, so there's no cognitive load here at all.
So yeah, if you ignore most of what matters, everything is the same.
Plus the point of the marshal interface is that it’s reusable.
If you wanted type safety with JSON in Go then don’t use the marshal interface. Period.
Go has this concept baked into the language. For example read and write interfaces so you can write data to an endpoint without having to worry about whether it’s a file system object, TCP/UDP socket, gzip achieve, and a plethora of other options too.
It’s a nice convenience feature and makes up considerably for the restrictions that the Go type system places.
And if you need higher performance code, or compile time safety, or have any other constraints that limit your ability to use these generalised interfaces, then you can use different APIs from the Go standard library to achieve the same thing.
You don’t need to call json.Marshal() if you don’t want to. It’s an option, but it’s just one API into the JSON toolbox.
Secondly, other languages like rust, haskell, scala, etc. Have json APIs that are typesafe and give you compile time errors if you try to use a type that doesn't support (de) serialization . In the case of rust at least, the API is also general and can be used for other data types as well.
Even in go, you could have some more type safety if Marshall took an interface (such as MarshallerTo) rather than `any`. Although then you have the problem of how you implement that interface. So I guess you probably want some kind of "derive" functionality, or macros that can approximate it for a convenient and type-safe API.
P.S. gophers like to talk about how explicit being better than implicit, but using reflection for marshalling is very implicit.
If you want type safety then pass a struct to the marshal. Which is actually the idiomatic way to do it anyway. The type safety would be in that.
I’m not going to disagree with you that Gos type system is a rather blunt tool nor that Gos expressiveness is extremely rigid compared to many other popular languages. All of that is completely true. But I don’t agree that the v2 JSON API is a good example of that problem.
The function is in the `encoding/json/v2` package. It might have a similar design, and maybe they will use the same function signature for other encoders, but it the functions are very much json specific.
> If you want type safety then pass a struct to the marshal.
But if you use a struct that has a field that can't be marshalled, you don't get a compile error, you get a runtime SemanticError. That's the problem.
But the point you keep missing is that the function signature needs to be encoder agnostic for it to work as an interface.
> But if you use a struct that has a field that can't be marshalled, you don't get a compile error, you get a runtime SemanticError. That's the problem.
And as I said elsewhere, no such fields exist.
It's a function, not a method. So it can't be part of an interface.
I suppose you could make an argument for passing it as a function argument to a higher ordered function. But that is kind of an unusual way to use such a function. And isn't a common pattern in go.
> My point here was: if you know you’re creating a struct to pass to the mashaller at compile time, then you’re already going to use JSONAble fields. So it’s not an issue.
Maybe. Maybe not. For a simple struct where all the fields are primitive types sure. But if you have a complicated hierarchy, you might miss that some strict in the hierarchy has a field that can't be marshaled.
Say you are marshaling a struct that contains a struct from a third party library, and it works fine. Then you update to a new version of that library, and that added a new field for a type that doesn't work, say a map[A]string where A is a struct. Your program still compiles fine, but then you get an error at runtime when you try to serialize something that worked before. Hopefully you have tests that catch it.
The mashaller here is a function, yes. But having a consistent signature means you can interchange those marshallers. It’s a trick I use heavily in murex to enable typed pipelines.
And I do this via a pipe interface. So it’s not uncommon to reuse function signatures for interface types (fewer runtime abstractions) while retaining some level of dynamism.
> Say you are marshaling a struct that contains a struct from a third party library, and it works fine. Then you update to a new version of that library, and that added a new field for a type that doesn't work, say a map[A]string where A is a struct.
The first mistake there is to blindly forward an API struct that you don’t control and depend on that for business logic.
Which comes back to my point about if you want type safety then you’d create a struct.
I do take your point that the compiler in smarter languages would catch this. But you’d equally be told not to do this sort of thing on those languages too.
Compile time cannot check for runtime values (not even in Rust) - is your position that fields can only be populated at compile time?
I think the same is true for channels too but I’m not near a computer to check.
https://pkg.go.dev/encoding/json/v2#Marshal says otherwise:
> The Go map key must encode as a JSON string, otherwise this results in a SemanticError
> All other Go types (e.g., complex numbers, channels, and functions) have no default representation and result in a SemanticError.
v1 has the same constraints.
The doc you linked to literally proves me right.
Because they are common types, makes sense to precautionary have the error return.
I wish they'd left `MarshalIndent` in there though. The equivalent code is super complicated and non-obvious, so it's a pain to migrate, and it's a pain when you're banging out some quick code and want to dump some readable JSON. I suppose these days the LLMs can write the complicated version for us, of course.
Not an insult to you, its just how I feel things are going, myself inculded at times.
Or more concretely, if we had a parser generator + json parser specification that can generate efficient simdjson style parsers, then we should be able to parse json restricted to a subset of json based on a schema at least as efficiently as simdjson can parse general purpose json.
That way we could have the best of both worlds, a (potentially lazy) statically type-safe model and simdjson performance!
I still think that this is definitely doable, it's just that a lot of infrastructure needs to be built for it.
I remember reading that Meta is doing something similar with binary formats. I find it weird that there's nothing like that for json yet.
https://dl.acm.org/doi/pdf/10.1145/2714064.2660241
https://dl.acm.org/doi/pdf/10.1145/3314221.3314625
I think most people who use JSON don't want strong typing or to use schemas. If you do, you just use a different serialization format: JSON is designed to be a generic, human-readable way to basically represent any kind of data structure (since it deserializes to JS objects). So everything about JSON is working against you if you do try to enforce type/schemas on it.
A grpc-like protocol with more prescriptive type registries/discovery (over the network) and better interop with http (like grpc-gateway) would be the best approach IMO. Definitely not JSON schema
Not necessarily. It's biggest advantage is probably that it has very good interoperability. Basically every language has a readily accessible library for json, and even if you don't, it isn't that hard to write a parser and/or generator for it. And being human readable isn't something to sneeze at either.
We use JSON because it's standard, human-readable, mostly self-described and works natively with Javascript.
You can read JSON object without having to know the schema even if one exists.
Protobuf is unusablr garbage without a lot of supporting tooling.
I have been using serde without issues, and never resorted to `serde::Value`[0], the untyped option, so far.
I have yet to experience anything working against me.
[0]: https://docs.rs/serde_json/latest/serde_json/enum.Value.html
Pretty much anywhere I've come across JSON (and xml before that,) everyone expected strong typing. The fact that JSON (and xml) can represent different data than they anticipated "did not compute" in their heads.
In many cases, they were treating JSON (and xml) as dumb serializers and not even paying attention to the output and corner cases.
So yea hopefully a nice new addition but only my prompts now matter. So need to make sure they pickup on the new API.
I am using local LLMs and Go has a bunch of strengths where smaller contexts are concerned; less complicated flow of control being one of them.
And the things that we do to manage this, that are symbolic or based on visceral real-world analogy, are good for us and bad for them.
Go is kind of in the middle, in the way that many vaguely Wirth-like and CSP-like languages possibly are, I guess.
However it kind of makes me feel like my professional life was wasted and I don't really know what kind of future I have. One of Go's main points was you can pick it up in a weekend. What career moat do people like us have?
Considering it just pulls and remixes blocks, this is a very tall order for today's LLMs, and maybe a couple of generations as well.
Calling GCC/clang at the back and emitting ASM is both cheating and has no advantages whatsoever as well.
This isn't futurology, besides a few projects that already came up on Phoronix and around here, with Assembly generation, there are enough SIGPLAN papers on ML driven compilers already.
However, starting with LLMs directly generating machine code and moving to ML directed optimization passes, you're moving the whole stadium with a crawler-transporter, not only the goalposts.
Helping compiler in a well defined way, and working on IR or driving it repeatedly to optimize the output is one thing, generating machine code from a training set is other. Let's not mix them.
"Compiler 2.0: Building the Next Generation of Compilers with Machine Learning"
https://eecs.berkeley.edu/research/colloquium/compiler-2-0-b...
There are other researchers if you interest yourself on the matter.
Then the whole iPaaS agentic coding environments like Workato and Boomi, that even if they might generate 3GL as intermediate step, you don't get to see it.
https://github.com/zwang4/awesome-machine-learning-in-compil...
Using small, purpose built ML "things" to make things better makes sense. We use them everywhere. I never argued against it, as well.
If 3 GL code has to be generated, my option list won't certainly have Go on it.
In case you answer there don't fit the same purpose, there are tiny baggers that replace shovels altogether.
This demonstrates that you continue to misunderstand the analogy.
Let's speak plainly. Someone who attempts to use LLMs to generate assembly directly will be outcompeted by someone who uses LLMs to generate code in a high-level language, which then uses an ordinary compiler to generate assembly. The value of a high-level language is that it defines a more constrained abstract machine than the machine that a CPU represents, which both humans and LLMs alike benefit from.
Letting it generate machine code directly would be the opposite of that.
As for proven wrong,
"Frame was created over the past month largely via Claude Code. The Assembly code in all its glory can be found on GitHub."
https://www.phoronix.com/news/Frame-X11-Server-Assembly
Binary bloat is not just about size; it impacts startup time and icache. It’s basically the speed of light launch time.
So you’re telling me rust is not good for UNIX style tools.
If you code in Go, the code is more high level, prettier, simpler.
If you code in Rust, the code is more robust, efficient, faster.
Both are important for LLM, why can't we have a high level, simple language that is also robust, efficient and fast? =)
I think many variants from Rust can be stripped to make it simple, especially in type system, which is way more complicated than go.
LLM can generate very cryptic rust code.
It's really great fun to build stuff in Crystal, I don't have anything prod-grade yet to say how it scores there but the community seems to be happy about that too.
Expressive and type safety of a functional language, without the odd semantics of Haskell, where laziness can make performance difficult to predict and purity can make simple things like IO difficult to understand.
I' just starting OCaml, so can't really compare, but it seems a good progress there.
Go is about as far as you can "go" to the efficiency end without becoming Rust. It's a low-overhead language (like C) but with a GC that ensures memory safety. If you want to manage memory yourself and still prove safety it gets very complicated, as we see in Rust.
First, I like programming and don't want to stop doing it just because a machine can do it too. Second, I'm pretty sure atrophied coding skills will make me worse at directing the machines, thus worse at what seems to be "the job" these days.
In theory wouldn’t atrophied coding skills not matter if models are sufficiently good at coding? I mean isn’t whats left just design and architecture and testing?
Sure, if LLMs are producing shit code you need to have an understanding of what it should do instead. But I think that day is already gone.
Its hard to think of a skill that you’d need to build with an LLM that requires writing meaningful amounts of code by oneself. From my end all the complexity is business logic and system design.
I am begging HN users to understand that some people enjoy writing software themselves
No, I didn't. I claimed that if my coding ability atrophies, I expect that my ability to code through LLMs will decrease. And this is an outcome I want to avoid for the stated reasons and others.
That said, I get your point: maybe "the thing writing the code" will be as abstract as "the thing moving the electricity through transistors" at some point. And maybe I will be wrong about coding skill translating to good agent-herding skill. But I don't think I'm wrong now.
Please reread my comment. That’s not what I’m addressing.
“Programming” is a bit loaded. Do you mean thinking through and typing everything out yourself?
What design skills specifically can you only develop from continually programming in this way?
Personally I’ve found the opposite to be true. As writing out code myself has shrank to nearly 0, I now have a much shorter feedback loop on design. You get a lot more repetition and feedback when that’s basically all you are doing.
Weeks and month for to wait for a feedback in developing software? Are you the sloth in zootopia?
The longest cycle for feedback for me has only been hours. And that was about redesigning the core architecture of an app. Otherwise, it’s like 10 minutes cycle if it’s edit-compile-run, 5 minutes if it’s REPL (lisp, bash, python,…).
As I write code myself I continously take into consideration stuff like following the consistency of the entire design, whether what I'm doing is efficient, etc. LLMs are terrible at this and I don't see how you could develop such skills by prompting only.
For example, I would never produce designs that require degenerate db access patterns (linear scans, etc.). Everything I write myself always takes into account using db & network efficiently from the ground-up. Every query is an index lookup, every api request is rate limited, everything is batched and cached, so on and so forth.
LLMs meanwhile don't care about any of this. I just had Claude happily try to fetch youtube page html because the api didn't expose something. Great idea, I'd love to be banned by google for scraping.
Designing with performance in mind is black magic too, I need to notice myself that stuff that I think has no reason to be slow (pretty much nothing does) is slow and hammering the llm to finally come up with a non-stupid design that's not ridiculously slow and wasteful. Yeah, why don't we pull 2.3mb of html to update a list, sounds good.
Agents make it too easy to gloss over too much. They're great at work where i care about productivity but I've zero interest at home where the point is learning and having fun
The few times I've needed a language without a GC and used Rust and C as target languages, I've reviewed the code less and enjoyed it less.
JIT and AOT compilers, REPL development, bleeding edge GC implementations, Java, Scala, Kotlin, Clojure, C#, F# to chose from, and modern IDEs inspired by Smalltalk/Lisp Machines experience, batteries included backed and frontend development frameworks.
I hope you're not still doing this, it's nothing to brag about.
Unfortunately, the world makes it hard to keep that cycle, and so instead I mostly do 17 hours awake / 7 asleep, which makes me feel constantly tired (though less tired than 16/8 at least).
Why? Because I don’t give time to wait for code to compile on my time and I don’t have time for people to learn a new language for review at work.
Life is good! Would recommend that split.
In what sense? Go has a GC and binary sizes are relatively pretty huge. Its closer to Java and C# than C.
I'm just getting the neuron-band back together where Golang is concerned. I have done some in the past for little system tasks, but I am switching away from interpreted languages entirely for web stuff, and initially to Go, as I switch away from hand-coding to at least LLM-supported coding.
So I am a bit out of date on the pain points (I never really felt pain points when I last used it, because the jobs I was doing had very small, quite Go-friendly shapes).
I'm not entirely surprised, and I'm glad the Go team is carefully considering their interfaces before launching. But 6 years seems like a lot of work to land a JSON API.
JSON processing, quite markedly, is renown in Go for being slow, so I don't really understand why it took so long
I kind of like that the standard library doesn’t move fast. It makes it easier to fit the ecosystem into my head (unlike, for example, the JavaScript ecosystem where I find code doesn’t survive 2 years before failing to compile).
But I do agree that slow and steady produces its own problems. Your example of generics is a good one. But think the example of Go modules is another, perhaps even better, example of how sometimes the Go team really should have accelerated their efforts on.
Dependency management is a freaking nightmare, nobody has managed to create something that is bulletproof, not cargo, npm, apt, yum, nix, homebrew, nothing.
The key issue is that you're managing 3rd party software that may or may not adhere to the prescribed lifecycle/versioning
The Linux variants do it by each having dedicated teams watching upstream sources, taking what they believe to be whatever they feel is right, building for their nominated target(s), then testing, before deploying (on top of that, all of these steps vary in importance and rigor depending on numerous variables)
For programming libraries (which is what depmod, goose, vgo, and modules are managing) it's just as bad, if not harder, because their very nature is to provide a base upon which other developers can turn into whatever their imagination.
Add to that, modules was (initially) written by people who were dealing with a slightly different ecosystem; Google rather famously has a monorepo, making their lives a little easier when it comes to managing dependencies.
So, with those things in mind, dependency management is always going to be a hard problem that is opinionated (eg. I have a firm opinion that there should be an easier way to "pin" a dependency, other than vendoring - note that this isn't an invitation to every junior Go developer to come and claim go.sum does that. It doesn't. go.sum is a log of what dependencies were used for the last build by whomever wrote to it)
But my point was Go waited until there were multiple established 3rd party package management tools for Go already in widespread use before even releasing their own experimental implementation.
Their inaction caused far more disruption to the ecosystem because people got fed up of waiting, implemented their own, integrated it into their workflow and then had to reintegrate a whole new system all over again a year or two later.
Your point about Googles needs is the one often cited for Gos inaction. But I think that actually makes the situation worse. Because if the Go team cannot empathise with use cases outside of one bespoke enterprise, then it really shouldn’t be released as a general purpose language available for all to use.
And I say this as someone who generally likes the language.
Especially since "Go team cannot empathise with use cases outside of one bespoke enterprise" — it shows self-awareness of their shorcomings. I think it's wise to let the target audience explore the design space themselves a bit first. Considerably lowers the risk of cementing the wrong design.
I do somewhat remember the drama around this at the time, but I my impression was that of a petulent community of various dependency management projects with too much ego attached to them to see the bigger, long-term picture.
Thanks for sharing.
Put this in your go.mod:
Then go.sum will do its actual job (along with GOSUMDB) and ensure you get exactly the revision of the code that you want.Only about a year from when the Haskell guys lent their expertise and it landing in a release. That's actually fairly quick given that it was a pretty significant change under the hood and constrained by only two releases annually.
The Go team was always clear that they didn't have the necessary expertise internally and were relying on the open source community to lend a hand. Unfortunately, open source doesn't mean open willingness to contribute.
https://homepages.inf.ed.ac.uk/wadler/topics/gj.html
Before Featherweight Go, there was Featherweight Java.
So maybe a language designed in 2012 (v 1.0 release year), should learn from history instead of hand-waving it away as needless fluff.
> In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier.
https://github.com/golang/proposal/blob/master/design/go2dra...
And not all on the team were convinced, here Rob Pike,
> I think the transition to getting polymorphism into the language through generics is has still got some years to work through there's still things that don't quite work right
https://youtu.be/yE5Tpp2BSGw?t=2134
If you go back and watch the original Go announcement it was made abundantly clear that they believed Go did need generics at the time but that they didn't have the expertise to do it. Yes it is true that the book was already written on it, but that doesn't mean anyone on the Go team was familiar with it or had the time to become familiar with it. Programming languages do not require gods to design them. Imperfect humans can too.
The experts on HN who know all the ins and outs of generics could have contributed but, you know, shitposting "go doesn't have generics lol" was apparently a better use of their time. But it is certainly not for anyone else to do decide how they live their life.
Go culture is not welcoming to experts contributions, Rust, D, C#, Swift and others, heck even Java, are more open arms to language designers.
You'd think one of the HN experts would have shown up to offer that expertise, but I guess there was a lot of "go doesn't have generics lol" to get out.
The Haskell muscle had proven their skills already with Featherweight Java, in 2006.
But obviously "go doesn't have generics lol" comments were even more important. Imagine what would have happened to HN if that wasn't repeated multiple times daily for years!
Within our company I saw people in other teams writing their own optimised JSON libraries for whatever hellish reason. I always reiterated the point that as soon as that app made a single IO request all those nanosecond savings are invisible. Yes, it affects your total CPU time for processing a request but compute was never ever a limitation for us and it's likely not a limitation for most people. And if the trade off is your app needs scale slightly larger versus writing custom JSON code or pulling in a third party dependency, then I'm accepting the larger scaling.
The biggest benefit of encoding/json/v2 isn't the speed, it's the improved API.
Wordpress powered by PHP is also the most widely deployed CMS.
That argument is not as great as you think it is.
> That argument is not as great as you think it is.
But at least it is an argument in contrast to the comment I was replying to.
Completely unrelated: can anyone tell me why language authors introduce in/out/inout function parameters (see also C#).
It feels like this is some rather bad workaround for something that breaks assumptions about parameters being passed into the function.
If the allocation is owned by the calling function which uses it internally and then doesn’t return it, it can be a stack variable. Or the same allocation can be reused many times in a loop. Or an array of allocations can be made all at once with foreknowledge of the total number.
But you might be conflating that with in/out for Contra/Co-variance when specifying a generic.
They are one way to implement multiple return values. For multiple returns, tuples can be used.
I feel that is the kind of broken default that will come back and bite a bunch of people, and will eventually need to be fixed in a v3.
This is definitely not what I expect in other language. I would argue this is a quick of Go though and not JSON's fault.
Just look at the inane rules for map and slice access, what gets nil and what is panic. Even if that were consistent, then you'd still left to wonder if json.field was truly zero or not there.
But that depends on whether they add monadic error handling in the first place, and if they do, if they intend to migrate the language's APIs to it - I don't think they would because the existing error handling is faster and everywhere.
Clearly it isn't, otherwise every language would have sorted it out by... a long time ago.
You can still use it though, and I built my tiny decimal library around it: https://github.com/ncruces/decimal
A JSON parser MAY accept non-JSON forms or extensions.
An implementation may set limits on the size of texts that it accepts. An implementation may set limits on the maximum depth of nesting. An implementation may set limits on the range and precision of numbers. An implementation may set limits on the length and character contents of strings.
At then there’s more vagaries with JSON schema.
Who knew the same object could have completely different definitions based on some flags?
There is no introspection and speed is superb. I would definitely recommend jsontext as a parser for anything non-straightforward.
I'm happy it's getting fixed!
"What if it sucks?"
"There are now TWO ways to do each thing! No more than TWO! I promise!"
It's like python again.
So yeah, if you ignore most of what matters, everything is the same.
The problem with “Batteries Included” is that batteries run out of juice eventually.
It’s versioned because the function signature differs but the abstraction itself doesn’t.
That’s not to say that Go doesn’t have multiple different abstractions for common problems too. Just that your specific argument here is incorrect.
"Sir we need a loop" "We will have for loop, and nothing else." "Only one lo.." "Only for loop"
I love it too, it’s a great way to keep the stdlib moving without actually breaking anything. Simple and efficient design.
https://news.ycombinator.com/item?id=44893833
Still searching the true solution:
https://github.com/golang/go/issues/27179#issuecomment-53634...
A proposal of the missing datatype for this operation mode has been just accepted:
https://github.com/golang/go/issues/69559