should we rename the Program grammar production?

John J Barton johnjbarton at johnjbarton.com
Thu Oct 11 10:18:03 PDT 2012


On Thu, Oct 11, 2012 at 8:54 AM, Andreas Rossberg <rossberg at google.com> wrote:
> On 11 October 2012 17:49, John J Barton <johnjbarton at johnjbarton.com> wrote:
>> "Script" is not neutral but neither is "Program" plus it's just wrong.
>> The language needs a name for both the unit of compilation and the
>> assembly of those units. The latter is a program right? So the former
>> needs a different name.
>>
>> "CompilationUnit" is a bit long but more correct.
>
> Except that the "unit of compilation" is an individual function in
> most contemporary JS implementations. ;)

That is not my understanding, but I don't think it matters: that is an
implementation specific notion without consequence. Whether the
compiler treats all of the top level statements of a <script> tag
individually or separately cannot influence the result. On the other
hand, the compiler must stop at the end of the <script> tag statements
and begin execution.

> More generally, I think that
> implementation-specific notions like "compilation" are to be avoided
> in a language spec.

On the contrary, implementations currently execute code at a specific
boundary, a boundary not identified in the spec as far as I understand
it.  The switch from compilation to execution is a notion fundamental
to the language.

>
> Script sounds perfectly reasonable to me.

A fine opinion and certainly better than "Program".
jjb

>
> /Andreas


More information about the es-discuss mailing list