You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes indeed - function calls should be supported, like in any expression. Having said that, the current function call binding should be improved so that function are automatically re-called when a bound element changes (and the function bound elements should be the function arguments + the function context (i.e. this) - in other words, when a direct property of a function context changes, the function should be called again to determine if the function result has changed (which is not the case today) - e.g.
// x should be reprocessed if arg1 or arg2 or c changes,
// or if a direct property of c changes - e.g. c.foo++;
{let x=c.getRating(arg1,arg2)}
I obviously believe this would be a great feature to have. Now I imagine it less restrictive than that. The current proposal implicitly gets the elements to watch (the function arguments and its context) while I'd be more in favor to let the developer explicitly state that, so that a function could be re-evaluated based on external factors that are neither arguments nor the context.
When discussing this, @benouat suggested a way to do that based on modifiers which I find kinda neat, something like this: <div class={watch(indicator)|classGenerator(arg)}>
Don't mind the syntax, the idea is essentially to tell Hashspace which function to be called and what to watch as target for re-evaluation.
What do you think?
The text was updated successfully, but these errors were encountered:
+1 for the general idea, which requires more code from the developer but is more exact: this way you simply express dependencies of the result of a function.
Considering that this result depends only on its input arguments and its context is pragmatic, and this would avoid to the developer to have to explicitly add them every time. However, this is not exact in this case. Imagine for instance a function that computes its return value from the result of another function. With this proposal, we would just tell that the function depends on the other one if the latter's dependencies have been specified too (dependencies are transitive), otherwise just manually determine the actual list of dependencies.
PK1A
added a commit
to PK1A/hashspace
that referenced
this issue
Feb 24, 2014
I'm opening this issue to discuss the possibility to extend the binding mechanism to function calls.
Background:
I obviously believe this would be a great feature to have. Now I imagine it less restrictive than that. The current proposal implicitly gets the elements to watch (the function arguments and its context) while I'd be more in favor to let the developer explicitly state that, so that a function could be re-evaluated based on external factors that are neither arguments nor the context.
When discussing this, @benouat suggested a way to do that based on modifiers which I find kinda neat, something like this:
<div class={watch(indicator)|classGenerator(arg)}>
Don't mind the syntax, the idea is essentially to tell Hashspace which function to be called and what to watch as target for re-evaluation.
What do you think?
The text was updated successfully, but these errors were encountered: