should we rename the Program grammar production?
I'm starting to work on the global scope/program/module level of the specification.
One of the pieces of awkward ES specification terminology has been the use of the word "Program" as the name for a global top-level StatementList. A ES "Program" is commonly only a single fragment of what most of us commonly think of as a program.
This terminology mismatch is going to get ever worse as we integrate modules.
Now would be an easy time to change the specification to eliminate this use of "Program".
I proposed that we replace "Program" in this context with "Script". This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block.
Objections?
Allen Wirfs-Brock wrote:
I proposed that we replace "Program" in this context with "Script".
This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block.
+1 -- it the term at least some engines use, and it makes more sense for eval, or at least it matches everyday usage.
+1 Tracuer uses 'Program' and that makes it too easy to forget that the program consists of multiple Program-s.... jjb
On Wednesday, October 10, 2012 at 6:14 PM, John J Barton wrote:
+1 Tracuer uses 'Program' and that makes it too easy to forget that the program consists of multiple Program-s.... jjb
On Wed, Oct 10, 2012 at 11:56 AM, Brendan Eich <brendan at mozilla.com> wrote:
Allen Wirfs-Brock wrote:
I proposed that we replace "Program" in this context with "Script". This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block.
+1 -- it the term at least some engines use, and it makes more sense for eval, or at least it matches everyday usage.
/be
-1
"Script" might be the most common execution context, but there is more then one of those to consider. I think "Program" is just the right amount of neutral. Also "script" has a negative connotations, eg "script kiddies" etc.
On Oct 10, 2012 4:20 PM, "Rick Waldron" <waldron.rick at gmail.com> wrote:
On Wednesday, October 10, 2012 at 6:14 PM, John J Barton wrote:
+1 Tracuer uses 'Program' and that makes it too easy to forget that the program consists of multiple Program-s.... jjb
On Wed, Oct 10, 2012 at 11:56 AM, Brendan Eich <brendan at mozilla.com>
wrote:
Allen Wirfs-Brock wrote:
I proposed that we replace "Program" in this context with "Script".
This
is much less confusing and matches the most common manifestation of an
ES
Program as an HTML script block.
+1 -- it the term at least some engines use, and it makes more sense for eval, or at least it matches everyday usage.
/be
-1
"Script" might be the most common execution context, but there is more
then one of those to consider. I think "Program" is just the right amount of neutral.
Also "script" has a negative connotations, eg "script kiddies" etc.
One of the pieces of awkward ES specification terminology has been the use of the word "Program" as the name for a global top-level StatementList. A ES "Program" is commonly only a single fragment of what most of us commonly think of as a program.
I agree.
I proposed that we replace "Program" in this context with "Script". This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block.
I'd thought of the same thing at some point. +1 from me.
On Oct 10, 2012, at 4:20 PM, Rick Waldron <waldron.rick at gmail.com> wrote:
-1
"Script" might be the most common execution context, but there is more then one of those to consider. I think "Program" is just the right amount of neutral.
This doesn't address Allen's point, though, which is that a JavaScript program contains many Programs.
Also "script" has a negative connotations, eg "script kiddies" etc.
Well, that ship kinda already sailed with the language's name(s).
On Wed, Oct 10, 2012 at 4:20 PM, Rick Waldron <waldron.rick at gmail.com> wrote: ...
Allen Wirfs-Brock wrote:
I proposed that we replace "Program" in this context with "Script". This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block.
+1 -- it the term at least some engines use, and it makes more sense for eval, or at least it matches everyday usage.
/be
-1
"Script" might be the most common execution context, but there is more then one of those to consider. I think "Program" is just the right amount of neutral. Also "script" has a negative connotations, eg "script kiddies" etc.
(I apologize for hitting Send on my phone with an errant finger resulting in an empty post).
"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.
jjb
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. ;) More generally, I think that implementation-specific notions like "compilation" are to be avoided in a language spec.
Script sounds perfectly reasonable to me.
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
John J Barton wrote:
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.
No, this ignores function and var hoisting.
On Thu, Oct 11, 2012 at 11:03 AM, Brendan Eich <brendan at mozilla.com> wrote:
John J Barton wrote:
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.
No, this ignores function and var hoisting.
So that just means functions aren't the unit of compilation as previously claimed right?
In any case, I only want to bolster Allen's suggestion to add a new word for code fed to the compiler before execution.
jjb
John J Barton wrote:
On Thu, Oct 11, 2012 at 11:03 AM, Brendan Eich<brendan at mozilla.com> wrote:
John J Barton wrote:
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. No, this ignores function and var hoisting.
So that just means functions aren't the unit of compilation as previously claimed right?
No, it means your statement "[w]hether the compiler treats all of the top level statements of a<script> tag individually or separately cannot
influence the result"is not true.
Engines indeed must parse whole scripts but need not "compile every function" at that time, so some engines are indeed deferring anything beyond parsing until first call to a function. This means that any nested functions and vars, while also parsed, have their compilation to something executable deferred too. The skeletal parsing does not even necessarily save a parse tree to interpret.
This deferred compilation is not observable, indeed.
In any case, I only want to bolster Allen's suggestion to add a new word for code fed to the compiler before execution.
The best of a bad lot, IMHO, is still "Script".
list-noob here - I hope this gets threaded ok.
One of the pieces of awkward ES specification terminology has been the use of the word "Program" as the name for a global top-level StatementList.
This, I think is what (the noun) "program" should be reserved for.
A ES "Program" is commonly only a single fragment of what most of us commonly think of as a program.
And these sub-components are lesser nouns, "script" -s
This terminology mismatch is going to get ever worse as we integrate modules.
All of which are "scripts" to become a part of the "global top-level StatementList" <= Program.
Said another way, we don't directly write programs, we compose scripts which are "marshalled"/assembled into the Program by the runtime/compiler, which is, if I've understood Allen (heck, even myself!) correctly, the opposite of what Allen is suggesting :
I proposed that we replace "Program" in this context with "Script". This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block.
And of course, <script> is only one mechanism by which scripts are
placed in the Program/"global top-level StatementList" (modules, node et al).
$0.02 Russ / @codacoder
I'm tarting to work on the global scope/program/module level of the specification.
One of the pieces of awkward ES specification terminology has been the use of the word "Program" as the name for a global top-level StatementList. A ES "Program" is commonly only a single fragment of what most of us commonly think of as a program.
This terminology mismatch is going to get ever worse as we integrate modules.
Now would be an easy time to change the specification to eliminate this use of "Program".
I proposed that we replace "Program" in this context with "Script". This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block.
Objections?