News for hackers. Stuff that matters.
Re:Towards Principled Reactive UI by mattgreenrocks on Saturday September 26, 2020 @05:11PM (#24602160)
I'm probably missing something here, but is there a reason these toolkits don't require the dev to specify a stable, unique ID for each node? Feels like there's strong precedent with HTML's id attribute and CSS.
Re:Towards Principled Reactive UI by michannne on Saturday September 26, 2020 @05:30PM (#24602308)
Because IMGUIs are designed to be procedural, making it easy to couple changes in UI with changes in control flow. Requiring an ID for every widget would get really annoying really fast, considering IDs would become voided pretty often. The default is no IDs, leave the ID assignment up to the developer who knows if and when an ID would be stable

You can wrap tools like Dear ImGui and Nuklear into a reactive framework that handles state management and IDs and such and presents an API with a declarative interface a la React, but at that point you're pretty much building your own UI engine and just passing rendering on to those tools, which is not simple to architect.

Re:Towards Principled Reactive UI by flohofwoe on Sunday September 27, 2020 @06:25AM (#24605619)
Dear ImGui does have stable widget ids, it's just not very obvious when looking at the API, and often also irrelevant for the API user. Usually it's the label string, but you can make those unique with special '#' postfix strings which are not displayed but only used to create a unique hash. There's also a push/pop API for identifiers (often useful when creating lists of items where labels are not guaranteed to be unique).
Re:Towards Principled Reactive UI by tkzed49 on Saturday September 26, 2020 @11:29PM (#24604011)
Further, you're in no way required (nor would you expect) to provide IDs for most HTML elements. In modern frontend development you often avoid styling elements by ID entirely, favoring classes instead.