News for hackers. Stuff that matters.
Re:Show HN: Skir – like Protocol Buffer but better by gepheum on Sunday March 08, 2026 @07:37PM (#47302843)
That is correct and that is a good catch, the idea though is that when you remove a field you typically do that after having made sure that all code no longer read from the removed field and that all binaries have been deployed.
Re:Show HN: Skir – like Protocol Buffer but better by joshuamorton on Sunday March 08, 2026 @09:11PM (#47303615)
How does this work if, for example, you persist the data in a database?
Re:Show HN: Skir – like Protocol Buffer but better by gepheum on Tuesday March 10, 2026 @08:17AM (#47322197)
Let's imagine you have this:

``` struct User { id: int64; email: string?; name: string; } ```

You store some users in a database: [10,"[email protected]""john"], [11,"jane",null,"[email protected]"]

You remove the email field later:

``` struct User { id: int64; name: string; removed; } ```

Supposedly you remove a field after you have migrated all code that uses the field and you have deployed all binaries.

In your DB, you still have [10,[email protected]","john"], [11,null,"jane"], which you are able to deserialize fine (the email field is ignored). New values that you serialize are stored as [12,0,"jack"]. If you happen to have old binaries which still use the old email field and which are still running (which you shouldn't, but let's imagine you accidentally didn't deploy all your binaries before you removed the field), these new binaries will indeed decode the email field for new values (Jack) as an empty string instead of null.