qface
qface copied to clipboard
provide support for defining default values in the interface files
It shall be possible to define default values for properties, struct members, enums, flags. E.g.
int value(10);
or using decorators
@default(10)
int value;
There shall be a documented rules for the different generators for default values (e.g. int => 0, real => 0.0, string => "". Are default values specific to the generator? For example for python it is True not true. So the IDL would need to define own default value syntax and a destination generator might need to transform them.
or using assignments:
int value = 0
Seems the easiest one.
struct {
int value = 0; // define 0 as default value when struct is initialised
list<string> = [ "hello"] // defines an array of values
}
interface Hello {
int add(int a=0, int b=1) = 0; // return 0 if not implemented
}
If we would introduce YAML format for annotations we can use the same format for default values.
int value = 0;
Status status = Status.Loading;