Currently we see functions as a set of parameters and one single return value. Here we suggest to have a set of input value and a set of output values for a function. E.g.
function(a: int, b: int) (c: int, d: int)
In c++ this would be:
function(int a, int b, c& int, d& int)
The value allocation is then on the caller side.
In the YAML spec the inputs and outputs will replace the params and return declaration.
operations:
- name: add
inputs:
- name: a
type: int
- name: b
type: int
outputs:
- name: c
type: int
will declare a c++ func as:
void add(int a, int b, int *c)
When called, the output parameter is stack-allocated and initialised with default value.
int c = 0;
add(10, 20, &c)
For go this would look like this:
var c int;
add(10, 10, &c)
This should also make the serialisation simpler as we always handle named vars, which can be encapsulated into a struct.
Currently we see functions as a set of parameters and one single return value. Here we suggest to have a set of input value and a set of output values for a function. E.g.
In c++ this would be:
The value allocation is then on the caller side.
In the YAML spec the inputs and outputs will replace the params and return declaration.
will declare a c++ func as:
When called, the output parameter is stack-allocated and initialised with default value.
For go this would look like this:
This should also make the serialisation simpler as we always handle named vars, which can be encapsulated into a struct.