Comments (4)
The basic idea here is that the core object graph is immutable. Edit operations are represented as pure functions that take one object graph and return another. The returned graph shares the subgraphs that haven't changed; for any given edit operation this is likely to be a large proportion of the overall structure.
Another way to think about this is as a fine grained copy-on-write strategy. It's also sometimes called a 'functional core, imperative shell' architecture and is popular for obvious reasons in functional programming. Keeping large sections of your code side-effect free tends to have benefits in testability and ease of reasoning.
Undo/redo in this implementation is trivial-- each undo state has a reference to the object graph at that time and undoing is simply resetting the 'current' reference.
In JS, sharing substructure can be done with shared object references and perhaps prototypal sharing via Object.create. I think es5 even has an Object.freeze that can be used to check our work as far as preserving immutability.
The trade off is that for some operations, updating structure in place is probably easier than copying the parts that change (especially if we have lots of parent references that need to be traversed).
from id.
Okay, so in-between steps from here to there - possibly we should exchange actual object-references in Entity
for lists of ids?
And we don't have a real 'parent' element right now - likely the data-storage part of iD.Connection
needs to be decoupled from the connection part.
from id.
Okay, so in-between steps from here to there - possibly we should exchange actual object-references in Entity for lists of ids?
An indirection layer that decouples Entity from parents -- I like it.
And we don't have a real 'parent' element right now - likely the data-storage part of iD.Connection needs to be decoupled from the connection part.
Yep. iD.SceneGraph
.
from id.
This is now implemented, onto particulars like #64
from id.
Related Issues (20)
- Moving source in front of external source inherits external url
- make `f` shortcut smarter HOT 1
- Data loss after getting an error saving
- Data loss after too many nodes in way error HOT 1
- Release as Electron app HOT 4
- Add "Loading...", visible on congested networks
- Can't upload some changes
- amenity=bicycle_parking area should not require area=yes HOT 8
- Snap to points and follow line in custom data HOT 1
- Height Limit field horizontally overflows sidebar
- Preset and rendering for boundary=protected_area HOT 2
- Publish npm package HOT 6
- Can't see which relation to add to HOT 5
- Change layer for intermittent natural=water
- Add building:levels to building=construction HOT 3
- Don't remove spaces after the semicolon in the [inscription] field HOT 1
- Side panel not scrolled back up when we click on another item
- Split road at five way junction with additional node too: possible but super hard HOT 3
- `npm run start` does not pick up css changes HOT 4
- Automatically synchronize crossing line and node tags (Rapid port)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from id.