Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 258 by mike.wel...@gmail.com: Allow service methods with 0 arguments and/or no return value
http://code.google.com/p/protobuf/issues/detail?id=258

I'm implementing a cross-network messaging system and trying to use the proto service section to tell my plugin about what 'methods' it should generate code for.

This 'system' consists of named objects which can send messages to one another. However there are no return values. You send a message to a named object, that object receives it, and if it wants to send something back in response it has to send a separate message back to the original sender.

So it's not RPC really, just a way of asynchronously sending messages to named objects on a network.

It would be useful if the proto compiler or services section would allow for a more general definition of messages/methods and arguments. At the moment the compiler requires a return statement and one argument.

Would there be a problem with allowing an empty/void return value and empty argument list? In my proof-of-concept I have created an empty message called 'void' and used that for the argument/return value where necessary to stop the compiler from complaining. But that's obviously a hack and leads to additional code being generated for the 'void' message.

As a more concrete example, let's say I have a multiplayer tic-tac-toe game and one message that can be sent is RequestGame. There are no arguments to this message and no return value. An object simply sends a reponse back accepting or rejecting the offer. What I would like to write in this case it:

rpc KeepAlive() returns ();

or just

rpc KeepAlive();

Would this be something you would consider supporting? If not, is there any way to extend the .proto language so I can add my own services-like section and syntax or should I just develop my own DSL for these purposes?


--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to