Immutable does not mean you have to copy the whole structure. You can store only the changes. This is how immutable data structures work in functional languages such as Haskell.
Vue can be used without Node.
You lose a lot though! You don't get minification and tree shaking, single file components, or hot module reloading. In practice, HMR outweighs the cost of setting up a Node/Deno/Bun environment.
> it seems that with signals you must use immutable values only. Imagine if you have, let's say, a text document model, and you need to create a new copy every time the user types a letter.
Too small. Imagine if you have a 2GB mutable file. Each keystroke in the middle of the file has to move the whole 2nd gigabyte backward.
Immutable representations of large buffers aren't flat arrays. The most obvious abstract semantics that we're depending on here is a map from indexes to byte segments. Immutably rearranging indexes can be made very fast.
> Imagine if you have, let's say, a text document model, and you need to create a new copy every time the user types a letter. That's not going to work fast. And there will be no granular updates, because the signal only tracks the value (whole document), not its components (a single paragraph).
Funnily enough, back when storage was slow enough that saving a text document involved a progress bar, one of the big advantages Word had over competitors was lightning fast saves, which they accomplished by switching to an immutable data structure. That is, while others would update and save the data, Word would leave it untouched and just append a patch, skipping lots of time spent rewriting things that an in-place edit would shift.
The “copy everything” mental model of immutable programming is really about as wrong as a “rewrite everything” mental model of mutable programming. If it happens it’s bad code or a degenerate case, not the way it’s supposed to happen or usually happens. Correctly anticipating performance requires getting into a lot more detail.
React is crazy because someone thought this was too complicated for developers:
event.listenTo(render);
event.emit();
And that we should do this instead:
property.listenTo(render);
property.set([property.get()[0]]);