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
f(...items);// ... becomes...f.apply(void0,items);// strict mode. Otherwise, 'this'obj.foo(...items);// ... becomes...obj.foo.apply(obj,items);// , but only want to evaluate obj once, so we inject an:function__apply(obj,method,args){obj[method].apply(obj,args);}__apply(obj,"foo",items);
CoffeeScript introduces a fresh var, hoists it to top, and uses it to prevent re-eval of 'obj'. Local vars could be done inline
Issue is that this would prevent potentially valid code from passing typecheck. Key idea is that we would be checking the arity that we know as well as the BCT, knowing that the spread arrays could be empty.
Questions
Do we want to be able to spread array-like, like the array-like objects that come from the DOM? If we do, we could use the CoffeeScript approach. We could tell arrays and array-like apart statically in the type system.
Activity
DickvdBrink commentedon Mar 8, 2015
Seems to be fixed with #1931