TheToolsmiths / ddl

Data Definition Language for Game Development Tools
MIT License
4 stars 3 forks source link

Support typed attributes #5

Open flaxed opened 5 years ago

flaxed commented 5 years ago

Support attributes with typed structure, instead of just supporting attributes based on primitive types.

An extension of #4, but because of its possible impact on the project, it should be considered more carefully.

Example (with placeholder syntax):

struct complex_data
{
   foo: { type: bool }
   bar: { type: float32 }
}

attribute complex_attr
{
  type: complex_data
}

struct some_thing
{
  complex_attr: { foo: true, bar: 20 }
}
leiradel commented 5 years ago

Another example with C-like syntax:

struct complex_data {
  bool foo;
  f32 bar;
};

struct some_thing {
  complex_data complex_attr = {true, 20};
  complex_data complex_attr = {foo = false, bar = 10};
};