Const functions with joining is ready for discussion

Maciej Stachowiak mjs at
Mon Sep 6 14:40:39 PDT 2010

On Sep 6, 2010, at 5:14 AM, Chris Marrin wrote:

> On Sep 5, 2010, at 7:19 AM, Mark S. Miller wrote:
>> At the last EcmaScript meeting, I proposed the "const function" notation seen at <>.
>> Someone -- my apologies, I forget who -- suggested that const functions would make the old never-implemented ES3 joining optimization safe. (If you don't know what that is, don't worry about it. The new explanation is self contained.) I have now enhanced that strawman page with a promotion rule for const functions that provides this optimization benefit is a predictable manner.
>> Opinions?
> Forgive my outsider comment. I was not at the meeting where this was proposed, so this may have been discussed. But it seems like using 'const' in place of 'function' may be syntactically valid but it's confusing to read. It seems like 'const function', while more wordy, would be more clear, as in:
> 	const function foo(a) {return a(foo);}
> Omitting the 'function' keyword is going to make many instances of this look like a function call rather than a function declaration. Does that cause parsing problems or something?

I like "const function" better as well. In the example above, foo() is "a constant function", not merely "a constant". Comparing to:

	const function bar(a) {return a(foo);}

You wouldn't say, "bar is a function, but foo is a constant".


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list