News for hackers. Stuff that matters.
Re:Connect-Web: TypeScript library for calling RPC servers f... by ghayes on Thursday August 04, 2022 @04:29PM (#32347928)
You missed my biggest gripe: the Golang influenced decision that "zero strictly equals nil." This decision is non-idiomatic in, honestly, most languages.
Re:Connect-Web: TypeScript library for calling RPC servers f... by shadowgovt on Thursday August 04, 2022 @06:05PM (#32348899)
It makes a lot of sense for a wire format to save space by having a default value and omitting the message when the value is the default, and by standardizing on a specific default, the protobuffer protocol avoids developers having to wonder what the default is for every field.

I agree that it can be a sharp edge for the tool if you don't see it coming... It can be convenient to deserialize a protobuffer into an in-memory representation for working with it. Proto doesn't do this for you because it would be unnecessary overhead if your code can just work with the protobuffers as-is, and protobuffer errs on the side of speed.

Re:Connect-Web: TypeScript library for calling RPC servers f... by dilyevsky on Thursday August 04, 2022 @09:23PM (#32350369)
That is not longer the case - they brought back optional in proto3
Re:Connect-Web: TypeScript library for calling RPC servers f... by throwaway894345 on Thursday August 04, 2022 @10:43PM (#32350936)
I’m not familiar with protobufs, but zero and nil are different types in Go. You can’t even compare a numeric type with a reference type (it’s a compiler error).
Re:Connect-Web: TypeScript library for calling RPC servers f... by tommiegannert on Friday August 05, 2022 @03:09PM (#32360560)
GP meant that you can't differentiate between the zero-value and "not present".

In proto2, strings were represented as *string in Go. In proto3, they are simply string, and "" is the default.

Re:Connect-Web: TypeScript library for calling RPC servers f... by FridgeSeal on Thursday August 04, 2022 @06:57PM (#32349360)
It’s especially awful because protobufs will incorrectly parse non-matching messages-filling in blank and mismatched fields, instead of just failing out.

Had that happen more than once, and it made for an extremely confusing situation.

Re:Connect-Web: TypeScript library for calling RPC servers f... by yencabulator on Friday August 05, 2022 @07:27PM (#32363120)
What. Protocol Buffers are from 2001, Go is from 2009.