3 ms·
Maybe I'm missing something particular about Rust? When the archive is loaded at runtime, we don't need explicit IDs: we have a normal object graph, with refere
by b3morales 5y ago
Maybe I'm missing something particular about Rust? When the archive is loaded at runtime, we don't need explicit IDs: we have a normal object graph, with references between things. The instantiated widgets have identity as objects in memory. The string `id="ykl-6F-b5r"` isn't relevant -- or used at all.
You can create as many instances of `Button` as you want, and they are different, and their targets (the other widgets they message when tapped) are different because they were either created alongside or, if they were live before the archive was deserialized, a reference was made to them as part of the deserialization process.
- verdagon 5y agoI think what you might be missing is that, in (safe + idiomatic) Rust, we actually can't have references between things (unless we want to make our entire GUI immutable, which would be a tad silly). Since we can't use references, we need to "refer" to other objects via IDs.
- b3morales 5y agoThanks, I'll have to look into how GUIs in Rust work then; that sounds utterly bizarre to me :) I thought you could take references to things in Rust. Also, in particular, I don't understand why you'd want to use closures -- inherently reference-y -- when everything else is (I guess?) a non-reference plain value.