lifecycle of a Node 2. Compiler will do it for you 3. You have to convince the compiler everything is safe. This is easier than using malloc/free but harder than using the GC. 4. No GC means better performance! 5. This does not get us any more guarantees.
access to the node you want to update. Grab nodes by stringly typed ids. 3. Can't control the granularity of updates 4. No place to save per node state
control when to render. Rendering a�er each update can be very expensive 3. Remember the current state of the page when making updates OR what you end up doing is checking the current state of the DOM to decide what to update 4. DOM is slow, memory is fast
is existential. A machine can have different internal states at different times. Existentials are hard in Rust 2. Even if we abstract the state into an opaque type, Rust abhors first class closures 1. We must know the size of the captured state. 2. We must know the lifetimes of the captured state.
initial machine �� State is the application state fetched from some place let machine1 = build(render(state1)); �� Attach the output node to the DOM �� This only needs to be done once let node = machine1.extract(); appendChildToBody(node); �� Arc so we can share machines let marc = Arc��from(Mutex��from(machine1)); �� Application loop, updates state and runs the machine �� Note that the node is automatically updated in the DOM
element node? The node name, AND a parent manages all the internal mealy machines of all the children struct ElemMachine { name: String, children: Vec<VDomMachine>, node: Node, }
the borrow checker. You end up with long functions with less safety guarantees 4. Less expressive type system (No typeclasses, existentials, gadts) 5. No first class closures 6. Code is o�en much more verbose, and has more chances to be buggy 7. Macros Ugh 8. Panics are business as usual
iterators. Mapping over vector should use builder pattern 2. Choose a blessed backend. Make performance a first class concern 3. Get proper linear types, and ownership tracking. Eschew GC when possible. 4. Fearless concurrency baked into the typesystem. There are papers on this. Regions of disconnected object graphs.