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

Complex metadata representation #3

Open
batiati opened this issue Jul 3, 2021 · 0 comments
Open

Complex metadata representation #3

batiati opened this issue Jul 3, 2021 · 0 comments
Labels
metadata Metadata code-gen

Comments

@batiati
Copy link
Owner

batiati commented Jul 3, 2021

Figure out the better way to represent those metadata complexities:

1. IUP elements that have attributes that are applied on children;

Example:

  • MDI attributes for Canvas for example

Proposals:

  • Render these functions in all possible elements, allowing to set them even when they are not children of the expected element.
  • Render these functions on parent element with a special signature .setXYZ(child, value); Maybe not ergonomics to declare in fluent API.

2. Complex union values

Examples:

  • Colors can be an RGB triplet or a well-known alias, like "BGCOLOR", "FGCOLOR", etc.
  • Tree.setValue expects an i32 representing the index, or a well-known alias, like "NEXT", "PREVIOUS", "ROOT", etc

Proposals

  • Status-quo: Declare an union with each possible value, for example
pub const Color = union(enum) {
    BgColor,
    FgColor,
    Rgb: Rgb,
};

pub const Selection = union(enum) {
    Next,
    Previous,
    Root,
    Index: i32
};
  • Use anytype in set; Each case may have a get behavior.
  • Declare two functions, one for each type, for example setColorRgb and setColorStr`

3. Handle or HandleName attributes

Example:

  • setImage and many others attribute should accept an Image or a string with the HandleName

Proposals

  • Status-quo: use aways string, for example setImage(image.getHandleName())
  • Use anytype in set; Each case may have a get behavior.
  • Declare two functions, one for each type, for example setImage and setImageHandleName`
@batiati batiati added the metadata Metadata code-gen label Jul 3, 2021
batiati added a commit that referenced this issue Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metadata Metadata code-gen
Projects
None yet
Development

No branches or pull requests

1 participant