aui icon indicating copy to clipboard operation
aui copied to clipboard

AUI_DECLARATIVE_IF

Open Alex2772 opened this issue 6 months ago • 3 comments

Describe the need of your project

If there's AUI_DECLARATIVE_FOR, there's should be a AUI_DECLARATIVE_IF, which conditionally disables visibility of (group of) views.

Proposed solution

/* pseudo code */
TextField { state->password },
CheckBoxWrapper { state->showPassword, Label { "Show password" } }
AUI_DECLARATIVE_IF(!state->showPassword) {
  TextField { state->passwordConfirmation }
}

Alternatives you've considered

But after re-consideration, I've recognized a more robust solution would be introduce property support to with_style, i.e.,

/* pseudo code */
TextField { state->password },
CheckBoxWrapper { state->showPassword, Label { "Show password" } }
TextField { state->passwordConfirmation } with_style {
  AUI_REACT(state->showPassword ? Visibility::VISIBLE : Visibility::GONE)
}

Additional context

No response

Alex2772 avatar Jun 24 '25 17:06 Alex2772

I'd escalate the problem further:

  • how to support properties in styles? - mentioned in TC, possible solution is to expand ASS so it can accept properties.
  • how to support animations? - probably with properties, although I think they are too slow to be reevaluated each frame.
  • how to support hot swapping (hot code reloading)? - this is an interesting challenge to AUI. Code hot swapping is actually a minor problem, which could be dealt by dynamic library reloading/self modifying code/any other means that involve executable pages altering. The real problem is retained nature of AUI, we need to wrap a call to setContents/ALayoutManager::inflate with a function which can be tracked in order to be patched and called again.
    • iOS does not allow operations on executable memory pages - need to investigate how SwiftUI does that
    • AUI/C++ builds are slow AF - need to speed up single cpp compilation. On Ryzen 5950X with 32 logical cores AUI takes around 5 minutes to build thanks to amount of parallelization, however, in order to build a single cpp with a lot of UI DSL (i.e., ExampleWindow.cpp), it takes up to 10 secs to compile and 5 secs to link. This makes AUI suck in comparison to HTML enjoyers who have instant preview of their sh*t.

Alex2772 avatar Jun 27 '25 02:06 Alex2772

I can propose a AUI_VISIBLE_IF(condition) macro which expands to AUI_REACT(condition ? Visibility::VISIBLE : Visibility::GONE)

na2axl avatar Oct 09 '25 14:10 na2axl

Yes, this is relatively close to what I would like to achieve

Alex2772 avatar Oct 09 '25 15:10 Alex2772