What do immutable bindings by default mean for arrays and objects?


#1

All of the examples In the RFC for the road to 2.0 use simple scalar values to demonstrate the difference between mutable and immutable bindings.

I’m curious how this pertains to complex values like arrays and objects. Is it only the reference that is immutable? Or will the object itself be protected from changes originating further down stream? For example, if I have some array that I want to pass to a component:

<my-component items={{anArray}}/>

Will the component be able to mutate that array even though the binding is not marked with the mut helper?


#2

Disclaimer this is purely conjecture I have no actual proof that this is the case.

I would imagine yes it would be possible but not recommended. I think the one way binding just means that if you assign to the bound thing in the child it won’t propagate that change to the parent whereas when the parent changes it it will propagate to the child. If you muck with things on that object I don’t think the binding will have anything to say about it.