Skip to content

Cool idea! #2

Description

@bcherny

Hey there!

I had a similar idea a while ago, but realized that without operator overloading this isn't a complete abstraction. Eg.

import {Map} from 'immutable-proxy'

const a = new Map({b: 1})
a.b = 2
assert(a.b == 2) // we just mutated a!

If we had operator overloading, we could do this, though it feels strange in JS:

import {Map} from 'immutable-proxy'

const a = new Map({b: 1})
const b = a.b = 2
assert(a.b == 1)
assert(b.b == 2)
assert(a != b)

Anyway, I ended up with this proof of concept: https://github.com/bcherny/auditable - mutable datatypes, backed by immutable data structures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions