New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
polymer properties -- need Property<T> to support synchronous notifications #18343
Comments
Also, maybe this is a better pattern to encourage: final _fieldName = new Property<T>(val); ... it's even worse at declaration time, but avoids the ".value" for access. @blois @sigmund -- thoughts here on best looking API? cc @blois. |
correction to above:
|
Ideas on how this would impact memory usage? In a system with an extremely rich set of bindable properties but which only a fraction of which are actually set, there's going to be quite a bit of overhead of these per-instance Property fields. If there's a base-class for these then there could be sparse storage of non-default properties in a dictionary on the base, using something such as: Alternatively, may be able to do: |
Removed Area-Polymer label. |
I'm trying to think of other alternatives, but I'm not sure I have the whole picture yet. Do we need both sync and async notifications, depending on how the property is used? Is this needed for Observable, or only for Bindable? Some ideas I'm trying to think about is whether this could this be addressed by adding a second API that provides the other notification timing. For example, '.changesSync' in Observable, or 'openSync' in Bindable? |
we need a property that redirects the getter/setter to another object, immediately. And is configured at runtime. The only way I could think of to get that indirection is having an object for indirection. We could do a transformation, but... it would have to be on in development mode too :(. I'm not really a fan of that, personally... At that point, it feels like we're inventing language syntax instead of just optimizing for deployment. But if you & Justin & Pete like the idea, go for it... cc @justinfagnani. |
Added this to the Later milestone. |
Issue #13567 has been merged into this issue. |
Added Polymer-P-2 label. |
Removed this from the Later milestone. |
Removed Polymer-P-2 label. |
Removed Polymer-Milestone-Later label. |
I've been looking into this while working on rolling the polymer package. The good news - the hacky code moved out of observe-js and now lives in polymer. If I understand correctly, here is my understanding of how timing is different here. The logic is differs when there is a binding on a property and when there is not, so here is are details for each case. I am using No bindings: - dart read operation - js write operation - dart write operation With a binding on the property: - dart read operation - js write operation |
I decided to go with Pete's suggestion. Part of the reason is that notifications are delivered from the object that contains the property, not the property object itself. The syntax looks like this: The change is included in the roll of polymer to match 0.3.4 of polymer.js, which includes also computed properties. See: Added Started label. |
this was landed a while back |
This issue has been moved to dart-archive/polymer-dart#169. |
as implemented by observe-js Observer.createBindablePrototypeAccessor and Observer.bindToInstance.
googlearchive/observe-js@762f600
I've been ignoring this problem for a while because
final Property<T> fieldName = new Property<T>(val);
is more verbose than@published T fieldName = val;
, and it adds verbosity to usage. But I don't think we can anymore. On the bright side, we can more easily experiment with other ways of doing notifications.The text was updated successfully, but these errors were encountered: