Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

JS-bridged value types' immutability is painful #72

Open
andymatuschak opened this issue Apr 15, 2015 · 0 comments
Open

JS-bridged value types' immutability is painful #72

andymatuschak opened this issue Apr 15, 2015 · 0 comments

Comments

@andymatuschak
Copy link
Contributor

JavaScript doesn't have value types, but we have custom types for things like Point, Rect, Border, Segment, etc. This is painful for a number of reasons, but for this issue, my complaint is that you can't write:

layer.border.width = 3

Instead you have to write:

layer.border.width = new Border({width: 3, color: layer.border.color})

We've intentionally disabled property setters for these value types because their parent wouldn't notice if the properties' values change. We could set up explicit observers of the returned bridged values to fix that.

/cc @saniul (c.f. #70)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant