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

provide support for defining default values in the interface files #7

Open
jryannel opened this issue Dec 7, 2016 · 3 comments
Open
Assignees
Projects
Milestone

Comments

@jryannel
Copy link
Collaborator

jryannel commented Dec 7, 2016

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;
@jryannel
Copy link
Collaborator Author

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.

@jryannel
Copy link
Collaborator Author

jryannel commented Feb 3, 2017

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
}

@jryannel
Copy link
Collaborator Author

If we would introduce YAML format for annotations we can use the same format for default values.

int value = 0;
Status status = Status.Loading;

@jryannel jryannel self-assigned this Oct 17, 2017
@jryannel jryannel added this to the 2017-12 milestone Oct 17, 2017
@jryannel jryannel modified the milestones: 2017-12, Cleanup Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
QFace
Incoming
Development

No branches or pull requests

1 participant