You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🚴 perf(append): Avoid recording intermediate states.
This introduces more non-pure methods which can only be used with care.
Currently these are prefixed with _UNSAFE_ but maybe _NON_PURE_ would be
better?
The dev and user experience would certainly be better if we exploited
TypeScript types to ensure whatever is passed down to these methods is
marked as mutable (including `this`) and whatever comes out of the API
is immutable.
We could also expose these non-pure methods for special usage but with
extreme care. Maybe something like
`tree.mutable()._NON_PURE_push(x).immutable();` or
`tree.bulk((mutable) => mutable._NON_PURE_push(x));`. There are examples
on how to handle this in `funkia/list` and `immutable.js`. Is the
_NON_PURE_ prefix really necessary then?
The two previous points would allow and exploit the definition of a
`VolatileDeep` or `MutableDeep`, not sure on the name yet, whose right
and/or left digit is mutable ("or" because we could also settle on
`PushableDeep` and `ConsableDeep`). This would allow to replace digits
with either specialized mutable digit objects OR with JavaScript
Arrays depending on which solution is faster (member assignment + class
method table or Array push + switch on Array length).
0 commit comments