slint icon indicating copy to clipboard operation
slint copied to clipboard

`@children[<NUMBER>]` to index into the `@children` array

Open hunger opened this issue 5 months ago • 0 comments

We want to make @children more useful.

While we got stuck with naming children, we all agreed that indexing into the "array" of @children makes sense.

I plan to implement this.

I want the compiler to support @children[x] where x is a NumberLiteral. This is the simplest possible use case and several @children[x] are allowed in a componant.

  • The first child will be @children[0], to stay compatible with array indices in slint.

  • If x @children[...] are used in a component, then

    • you must have one @children[y] for all y in [0; x[
    • you must provide exactly x children when using the component.

hunger avatar May 26 '25 18:05 hunger