8

Google has removed unknown fields in proto3. I would love to hear the reasoning behind this choice. Also, if anyone has any way to replicate the proto2 behavior I would love to hear it.

If it matters, we are writing our code in Go.

As proto3 and grpc were developed in parallel, I wanted to reach out to the grpc community as well.

Source: Removal of unknown fields

4

1 回答 1

2

摆脱原语的字段存在使 Protobuf 在许多语言中更加“自然”和高效,因为 C/C++、Java、C# 和 Go 中的原语必须存在。在这样的语言中,如果您想要存在信息,您可以通过将其设置为指向原语的指针来“装箱”原语。

Protobuf 3 摆脱了原语的存在,但仍然具有消息的存在。因此,您可以对 Protobuf 使用相同的“装箱”技术。Protobuf 现在有标准消息框原语

于 2015-06-04T16:08:22.310 回答