Skip to content

RDAMap.move problem #224

@hediyi

Description

@hediyi
const M = new MuRDAMap(new MuVarint(), new MuRDARegister(new MuVarint()))
const store = M.createStore({0: 0, 1: 1})
const dispatchers = M.action(store)

// { type: 'move', data: MuStruct { id: 1, key: 0, sequence: 2 } }
const mv = dispatchers.move(1, 0)
// { type: 'move', data: MuStruct { id: 2, key: 1, sequence: 1 } }
const mvi = store.inverse(M, mv)

store.apply(M, mv)
// { type: 'move', data: MuStruct { id: 2, key: 1, sequence: 1 } }
const mvr = dispatchers.move(0, 1)

The problem comes from we expect applying two identical action objects to the same state to result in different states. Since we're not supposed to touch the state when generating action objects or inverses, either mvi or mvr has to carry extra info to differentiate itself from the other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions