Giter VIP home page Giter VIP logo

Comments (1)

snproj avatar snproj commented on June 20, 2024

Hi! This sounds like a good idea to me; I also personally prefer the proto comments approach. I can think of some pros and cons to proto comments:

Pros

Compared to build flags, as you say they look easier to maintain and work with. We can:

  • Carry Rust-specific information inside proto files without affecting other proto compilers
  • Place this information more naturally next to the messages they affect, rather than having to remember to dump them all in one go each time before calling pb-rs.

Con

On the other hand, one downside I can think of for proto comments is that we have to actually modify the proto file itself. Proto files that at some point have been touched by a user of pb-rs may now be marked with what is essentially noise to users of literally any other compiler (even other Rust proto compilers).

Whether this will be an issue I think will depend on the use case of the proto file itself and whether it's very specific in its circulation (e.g. internally within a company), or if it will be exposed to the public at large. Thoughts?

Unless we can convince others to use the comment convention 👀 🤔

Implementation

Looking at the code, I'm wondering whether it's a good idea to implement this in a more generalized way, so that:

  • We might easily add in more keywords later on (like controlling whether a struct is owned perhaps?)
  • Other users (even those who've not heard of pb-rs) will at least be able to tell that these are magic comments that apply to Rust / a certain proto compiler.

What do you think?

On a side note, the addition of EnumField is nice; I was about to do something like that in order to properly implement deprecated fields for enums.

from quick-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.