> `Button[expand = false]:`

This certainly looks better than a pragma, it would however prevent me from 
supporting generic widgets in the future. Especially since the syntax also 
needs to support choosing an "adder" (a proc which adds the widget as a child 
to the parent), so `HeaderBar[add_titlebar]` would also have to be valid syntax.

> `Button(expand = false):`

Looks better, but would break backwards compatibility, since widget 
constructors such as `Label(text = ...)` are currently equivalent to `Label: 
text = "..."`. However `expand` is not an attribute of `Button` (and it should 
not be, since `expand` only makes sense when a button is added to a `Box`). One 
option might be to add a second argument list like `Button()(expand = false): 
...`, but I do not think that this looks particularly great.

Here is an idea, which would support adders, but abuses Nim's syntax a bit.
    
    
    Box:
      Button as (expand = false):
        icon = "..."
        ...
    
    
    Run
    
    
    Window:
      HeaderBar as add_titlebar:
        ...
    
    
    Run

Maybe the `add_` could also be either (a) automatically inferred or (b) just 
dropped from the procedure names, so the second example becomes: `HeaderBar as 
titlebar`. 

Reply via email to