liveBook · Manning

Delta

As explained in Building User-Friendly DSLs

A recorded atomic change to DSL content or to the abstract syntax tree representing it.

A delta (∂) is a recorded, local change to DSL content or its abstract syntax tree. Projectional editor actions produce deltas directly, making them suitable for incremental storage and transmission. section 10.1

The identified delta types are:

  • Changing the value of a simple AST setting. section 10.1
  • Creating or deleting an AST object. section 10.1
  • Moving an AST object within a multivalued setting, such as through drag and drop. section 10.1

Value-update delta

A delta can record its change type, target object, property, new value, and previous value: {"changeType":"valueUpdate","objectID":"<ID>","propertyName":"name","newValue":"bar","oldValue":"foo"}. section 10.1

{ 
    "changeType": "valueUpdate", 
    "objectID": "<ID>", 
    "propertyName": "name", 
    "newValue": "bar", 
    "oldValue": "foo" 
}

Inspect a serialized value-update delta and its fields. section 10.1

How Building User-Friendly DSLs covers it

How deep it goes
Defines three delta types and lists rollback and conflict-detection requirements, but defers full CRDT design.
Examples
Shows value updates, object creation or deletion, multivalued-setting moves, and a JSON value-update representation.
What it assumes
Assumes familiarity with ASTs, settings, and projectional editing while grounding deltas in editor actions.
What you can do after
Build incremental change recording and apply it to autosave, undo/redo, or collaborative editing.
How it connects
Connects deltas with abstract syntax trees, projectional editing, undo/redo, real-time collaboration, DVCS, and CRDTs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building User-Friendly DSLs. The section links point to the parts of the book it draws on.