barrister icon indicating copy to clipboard operation
barrister copied to clipboard

Add support for no return type

Open colega opened this issue 6 years ago • 2 comments

I tried to compile an IDL without any return type and it breaks:

plex.errors.UnrecognizedInput: 'None', line 3, char 16: Token not recognised in state 'type-opts'
Error loading IDL from STDIN: unexpected end of JSON input

Is it supported? If not, is there any reason to not support it? I think that empty result array is a valid response for JSONRPC request, right?

colega avatar Mar 15 '18 20:03 colega

Good question. I was basing that decision on the spec (http://www.jsonrpc.org/specification#response_object) where it says:

result
  This member is REQUIRED on success.

So I made function response types required on the IDL. I suppose we could send a null value there for void functions.

coopernurse avatar Mar 15 '18 23:03 coopernurse

I suppose that nothing prevents us from sending null value there (I don't know what I was thinking about when I said empty array). I'll try to make the changes to support it.

colega avatar Mar 16 '18 08:03 colega