Pass object by reference to other objects

Is that possible to pass property by references to other object.

Something to achieve this:

import EmberObject from '@ember/object';

const Person = EmberObject.extend();

let personA = Person.create();
let personB = Person.create();

personA.set('foo', 'bar');
personB.set('foo', personA.getReference('foo'));

personA.get('foo'); // bar
personB.get('foo'); // bar

personA.set('foo', 'baz');

personA.get('foo'); // baz
personB.get('foo'); // baz

Hey Charles,

We used to support two-way bindings between properties on an object, but that is a pattern we’ve moved away from. Our experience was that bindings, while useful for many scenarios, tended to be performance and understandability hazards.

Can you describe the underlying problem you’re trying to solve? While there’s nothing built-in that does exactly what you describe, maybe there’s a different way of approaching the problem.

Thanks for your answer Tom.

What I wanted would actually be a single way bindings. Only from A to B.

This is my use case. I have different lists (all components) in my app. All are a bit different but some parts of them are the same (good old problem) that’s why I started to split them. I put the logic of filtering, sorting and searching in a util object. This object is initialised by the component itself and gets the filter, sort and query input of the user from the list. I want to push the new inputs each time they change.

I ended not passing filter, sort and query but only the component itself and using alias('list.filter') to get the inputs in the list. This is bad because the util object only need three values to exists not the whole object.

What I could imagine to have is an observer which pass the value each time it change.

export default Component.extend({
	filter: 'type',
	sort: 'createdAt',
	query: '',

	list: List.create(),

	filterProxy: singleBinder('filter', 'list.filter')
	sortProxy: singleBinder('sort', 'list.sort')
	queryProxy: singleBinder('query', 'list.query')