by adamnemecek · 6y ago · 0 comments
A browser might have multiple representations of a DOM node in memory (the pipeline from DOM to GPU is really long). I have like one.
I realize this is only tangentially related.
Problem with them is disrupted control flow and implicit capturing of the context. However, in cases where you have to guarantee something to happen after user code, the RAII guards can't replace the closures, because drop() isn't guaranteed to be called even in safe code...
The ECS GUI integration is an interesting direction. I think Rust ecosystem looked at it, and it was hard.
I think that we need more time to explore this. It took the OOP GUI frameworks a long time to mature.
As a comparison, imagine your bank's lending products. You probably don't want to hardcode them into a type hierarchy with a virtual method AccrueInterest(Date), but rather have flags that indicate which loans accrue daily, which loans accrue monthly, which loans have some secondary interest etc.
Like you can't have a type mismatch with systems, since you get the data you queried.
Also I find code like this to be anti-ECS https://docs.rs/orbtk-api/0.3.1-alpha2/src/orbtk_api/macros..... They use macros as a workaround for lack of inheritance in Rust. I would not call that ECS.