Mark S. Miller (2013-07-16T18:14:23.000Z)
domenic at domenicdenicola.com (2013-07-19T15:37:50.780Z)
On Tue, Jul 16, 2013 at 10:54 AM, Claus Reinke <claus.reinke at talk21.com>wrote: > While I understand the compromise, and the wish to get in some form > of generators anyway, the discrimination against user-defined control > structures troubles me deeply. Troubles me too. As of ES6 the only possible alternative would be to remove generators from the language. I can't see that happening. > It introduces a new language construct > that defies abstraction. It means that we can no longer use functional > abstraction freely, but have to worry about interactions with generators. > > For the specific case of forEach et al, another way to avoid intermediate > stack frames would be guaranteed inlining. If this was the only motivation for introducing something like a guaranteed inline-ability annotation, I would not think it worth the price. However, such an annotation may serve multiple purposes. The key constraint it would need to impose is that the function is closed -- it doesn't capture any lexical variables other than the ES* defined globals. This is a minimal requirement for inlining, for parallelizability by Rivertrail, and for safe mobile code as in Q.there. In any case, since functions by default are encapsulated, some explicit annotation or syntax of some sort is required for the function to waive its encapsulation.