Skip to content

[FEATURE] New CP syntax#9478

Closed
cibernox wants to merge 2 commits intoemberjs:masterfrom
cibernox:new_cp_syntax
Closed

[FEATURE] New CP syntax#9478
cibernox wants to merge 2 commits intoemberjs:masterfrom
cibernox:new_cp_syntax

Conversation

@cibernox
Copy link
Contributor

@cibernox cibernox commented Nov 3, 2014

No description provided.

@cibernox
Copy link
Contributor Author

cibernox commented Nov 3, 2014

I see that @truenorth did the very same thing. Very similar implementation too.

@stefanpenner
Copy link
Member

I would love for you too to collaborate on this instead.

@cibernox
Copy link
Contributor Author

cibernox commented Nov 3, 2014

What do you mean? Both collaborate on #9477 or I keep working on this as a separate idea?

@cibernox
Copy link
Contributor Author

cibernox commented Nov 3, 2014

BTW, this is the easiest approach possible.
The internal semantics of computed remains the same, but at definition time I just build a function that decides if it should invoke the getter of the setter based on the number of parameters.

Not sure you think this is the best idea in the long term. Maybe it's more convenient to take the opposite path and change the internal behavior of computed to call the getter or the setter and when we provide a functions instead of an object we build an object with only a setter.

I think this would be more performant and would also simplify parts of the code.
By example Ember.set wouldn't need to check if a function is wrapped or check its arity.
The bad part is that this will be a breaking change. We can create a function that invokes other functions (like I just did) but we can't decompose existing functions with arity 3 into getters and setters.

We could do something like this and raise a deprecation warning if someone provides a function with arity > 1, because providing only a function means that is a getter-only CP, and eventually (2.0) refactor code to change the internals to the opposite, as I just explained.

@cibernox cibernox changed the title New cp syntax [FEATURE] New CP syntax Nov 7, 2014
@cibernox cibernox mentioned this pull request Nov 10, 2014
8 tasks
@cibernox
Copy link
Contributor Author

Closed in favour of #9527

@cibernox cibernox closed this Nov 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants