Giter Site home page Giter Site logo

Comments (9)

dsymonds avatar dsymonds commented on May 18, 2024

That's working as intended, and a deliberate choice for proto3. You simply aren't supposed to differentiate fields explicitly set to their zero value from fields not touched at all.

from protobuf.

myitcv avatar myitcv commented on May 18, 2024

@dsymonds - unless I'm missing something, the README still refers to the generation of pointer fields. Is there somewhere with updated documentation for proto3?

from protobuf.

myitcv avatar myitcv commented on May 18, 2024

This seems the most relevant.

from protobuf.

dsymonds avatar dsymonds commented on May 18, 2024

I'll update the README to mention the difference.

from protobuf.

myitcv avatar myitcv commented on May 18, 2024

@dsymonds - thanks

from protobuf.

Sahasrara avatar Sahasrara commented on May 18, 2024

Documentation still says "Non-repeated fields are pointers to the values; nil means unset. That is, optional or required field int32 f becomes F *int32."

It it possible to specify that pointers be used. It really saves a lot of pain.

from protobuf.

dsnet avatar dsnet commented on May 18, 2024

The documentation could be clearer, but below the bullet point list it says:

When the .proto file specifies syntax="proto3", there are some differences:
    Non-repeated fields of non-message type are values instead of pointers.

from protobuf.

wikiwong avatar wikiwong commented on May 18, 2024

I would love to hear an explanation of the design decision to no longer allow primitives to be expressed as pointers. There are many real world cases in which (for let's say, an int64) a 0 does not mean unset.

from protobuf.

dsnet avatar dsnet commented on May 18, 2024

I would love to hear an explanation of the design decision to no longer allow primitives to be expressed as pointers. There are many real world cases in which (for let's say, an int64) a 0 does not mean unset.

The Go team is not responsible for the protobuf language design. As such, we are unable to answer questions about motivation. Please redirect questions towards protocolbuffers/protobuf#1606

from protobuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.