Skip to content

Complex metadata representation #3

@batiati

Description

@batiati

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    metadataMetadata code-gen

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions