googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 55 forks source link

Is there a way to do one-time bindings? #14

Closed jmesserly closed 11 years ago

jmesserly commented 11 years ago

I was wondering if there is a way in MDV syntax to do "one time" bindings? Or if you folks have any syntax ideas.

A lot of our use cases for data binding are properties that are essentially immutable. It would be nice to save the overhead of observing those properties, because we know they won't change. We already built one app where we observed ~10k DOM nodes and ~13k bindings. Most of those bindings were "immutable". We're hoping to save memory overhead by letting the programmer indicate we shouldn't watch it.

Some discussion on this issue (for Dart Web UI): https://github.com/dart-lang/web-ui/issues/344

arv commented 11 years ago

If the property is non writable and non configurable we know the value can never change so we could skip setting up an observer.

Still, I think at some point we need to add a way for people to control this.

rafaelw commented 11 years ago

I don't think we have either a clear use case or a clear memory problem here yet. I've proposed a way to approach the issue described above here: https://github.com/dart-lang/web-ui/issues/344#issuecomment-16135413

I'm going to close this bug, but I imagine this issue will come up again. I'm open to this, but I want a really clear problem that it's solving.