Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

records vs maps #1

Open
vasu-dasari opened this issue Oct 24, 2017 · 1 comment
Open

records vs maps #1

vasu-dasari opened this issue Oct 24, 2017 · 1 comment

Comments

@vasu-dasari
Copy link

Hi,

This is more of a question than an issue.

I see that GPB Messages are essentially structured records. But, the grpc generates erlang files (from proto files) which uses maps. Is there a way we can generate record format for messages?

The main advantage I can see is,

  1. I can include the generated header file in other Erlang modules and we have a handy way of generating messages.
  2. Also, if protobuf initializes some members of a message to default values, records could have been initialized to those default values as well, thereby caller need not worry filling in those fields. If it were maps, the caller needs to populate every possible member of message or else, I could get a runtime exception when invoking a service which is using that Message.
  3. I could take the help of an editor to populate record fields for auto-completing record names or field names. Thereby code is less prone to typos.

If I can generate a record with existing code, can you please point me to an example on how to do that?

Thanks
-Vasu

@vasu-dasari
Copy link
Author

vasu-dasari commented Oct 27, 2017

I have created a pull-request to be able to specify protobuf messages as erlang records.
#2.

We can discuss further if this is the right approach to take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant