Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upInconsistent margin on ObjectLiteral evaluation semantics #956
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Jul 26, 2017
Collaborator
(Note that the behavior is not particular to that one case. It looks like every single-line production in the spec is flush-left, and every multi-line production is indented.)
|
(Note that the behavior is not particular to that one case. It looks like every single-line production in the spec is flush-left, and every multi-line production is indented.) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
loganfsmyth
Jul 26, 2017
Contributor
Totally, this is just a case where some things are single-line and some aren't in the same block, which makes it look inconsistent.
|
Totally, this is just a case where some things are single-line and some aren't in the same block, which makes it look inconsistent. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
Jul 26, 2017
This problem can be found in ES2015 and ES2016 as well as ES2017. It significantly impairs the readability of the spec, which isn't exactly a marvel of clarity in the first place. I know I want my time back trying to figure out what the heck it meant, viz https://esdiscuss.org/topic/reading-tail-calls-specification. :-)
With respect, I suggest this is an urgent issue that needs urgent resolution.
tjcrowder
commented
Jul 26, 2017
|
This problem can be found in ES2015 and ES2016 as well as ES2017. It significantly impairs the readability of the spec, which isn't exactly a marvel of clarity in the first place. I know I want my time back trying to figure out what the heck it meant, viz https://esdiscuss.org/topic/reading-tail-calls-specification. :-) With respect, I suggest this is an urgent issue that needs urgent resolution. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
Jul 26, 2017
I'll try to carve out some time to take a stab at this this weekend. Seems like the kind of thing someone not deeply involved in the spec can do, saving the heavy lifters for more heavy lifting.
tjcrowder
commented
Jul 26, 2017
|
I'll try to carve out some time to take a stab at this this weekend. Seems like the kind of thing someone not deeply involved in the spec can do, saving the heavy lifters for more heavy lifting. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
Jul 29, 2017
Flagging you as this may require changes to ecmarkup (or grammarkdown, but I think it would be ecmarkup). Or it may not; you may have a better idea — in any case, would benefit from your input. :-)
I'm brand-new to this stuff, but I believe the issue (No. 1 below; "Current") is because some of the productions are collapsed in the spec's source text and some aren't. Here's a sample of the Grammarmarkdown:
FunctionStatementList : [empty]
StatementListItem : Declaration
Statement :
VariableStatement
EmptyStatement
ExpressionStatement
ContinueStatement
BreakStatement
ThrowStatement
DebuggerStatement
Block : `{` `}`
Consequently we end up with some emu-production elements with collapsed and some without. The collapsed attribute on emu-production does two things to the styling: Makes the RHS(s) inline, and removes the margins. When there's a list of productions where some are collapsed and some aren't, the jagged indentation and top/bottom offsets cause confusion.
We could solve it without changing ecmarkup by adding collapsed to the emu-grammar for this part of the spec (No. 2 below; "Collapsed"), but it ends up still being fairly difficult to read.
Another option would be to not make any of those collapsed, but that too ends up not being very easy to read and being vertically verbose (No. 3 below; "Not collapsed").
Ideally (in my view), we'd be able to eliminate the margins on un-collapsed productions without making the RHSs inline (No. 4 below; "Aspire" [handcrafted]).
I don't think there's currently a way to do that in ecmarkup, is there? Should we add something? Or is there a better solution than any of the above?
In terms of an ecmarkup solution, it seems like it could be quite simple: Add a mixed-list (or whatever) attribute to emu-grammar:
<emu-grammar mixed-list>
FunctionStatementList : [empty]
StatementListItem : Declaration
Statement :
VariableStatement
EmptyStatement
...
</emu-grammar>...and style it like this:
emu-grammar[mixed-list] emu-production {
margin: 0;
}My tests tell me that ecmarkup is already happy to carry that attribute into the final result, so this ends up being a documentation and CSS change (which I'm happy to do and submit to ecmarkup as a pull-request).
But again, you might have a better idea? Thanks in advance.
tjcrowder
commented
Jul 29, 2017
|
Flagging you as this may require changes to ecmarkup (or grammarkdown, but I think it would be ecmarkup). Or it may not; you may have a better idea — in any case, would benefit from your input. :-) I'm brand-new to this stuff, but I believe the issue (No. 1 below; "Current") is because some of the productions are collapsed in the spec's source text and some aren't. Here's a sample of the Grammarmarkdown:
Consequently we end up with some We could solve it without changing ecmarkup by adding Another option would be to not make any of those collapsed, but that too ends up not being very easy to read and being vertically verbose (No. 3 below; "Not collapsed"). Ideally (in my view), we'd be able to eliminate the margins on un-collapsed productions without making the RHSs inline (No. 4 below; "Aspire" [handcrafted]). I don't think there's currently a way to do that in ecmarkup, is there? Should we add something? Or is there a better solution than any of the above? In terms of an ecmarkup solution, it seems like it could be quite simple: Add a <emu-grammar mixed-list>
FunctionStatementList : [empty]
StatementListItem : Declaration
Statement :
VariableStatement
EmptyStatement
...
</emu-grammar>...and style it like this: emu-grammar[mixed-list] emu-production {
margin: 0;
}My tests tell me that ecmarkup is already happy to carry that attribute into the final result, so this ends up being a documentation and CSS change (which I'm happy to do and submit to ecmarkup as a pull-request). But again, you might have a better idea? Thanks in advance. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Jul 29, 2017
Collaborator
I think if we just changed the margin-left for emu-production from 5ex to 0, that'd be a step in the right direction.
My guess is that the indent (and the top and bottom margins) are there just to make 'Syntax' sections nicer. If we add an attribute to definitional <emu-grammar>s (see issue #960), that would allow emu-production to have different styling in 'Syntax' sections.
|
I think if we just changed the My guess is that the indent (and the top and bottom margins) are there just to make 'Syntax' sections nicer. If we add an attribute to definitional |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
Aug 1, 2017
@jmdyck -
I think if we just changed the margin-left for emu-production from 5ex to 0, that'd be a step in the right direction.
Not just the left margin, the top and bottom too.
Yes, if they're just there for when example would be used in that case, then only having the margins on example would solve this problem.
tjcrowder
commented
Aug 1, 2017
|
@jmdyck -
Not just the left margin, the top and bottom too. Yes, if they're just there for when |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
Aug 3, 2017
@jmdyck @bterlson Or if the indentation is really there just to serve Syntax sections, put the body of Syntax sections in a section:
<!-- es6num="7.1.3.1" -->
<emu-clause id="sec-tonumber-applied-to-the-string-type">
<h1>ToNumber Applied to the String Type</h1>
<p>...</p>
<section class="syntax">
<h2>Syntax</h2>
<emu-grammar>
StringNumericLiteral :::
StrWhiteSpace?
StrWhiteSpace? StrNumericLiteral StrWhiteSpace?
....
</section>
...
...with:
.syntax emu-production {
/*...the current margins...*/
}...and remove the left, top, and bottom margins from emu-production.
tjcrowder
commented
Aug 3, 2017
|
@jmdyck @bterlson Or if the indentation is really there just to serve Syntax sections, put the body of Syntax sections in a
...with: .syntax emu-production {
/*...the current margins...*/
}...and remove the left, top, and bottom margins from |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
commented
Aug 5, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
commented
Aug 12, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Seems like #960 will solve this nicely (with some added css). |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
commented
Aug 13, 2017
jmdyck
referenced this issue
Aug 13, 2017
Closed
Adds grammarkdown checking for emu-grammar elements #960
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
Sep 22, 2017
@bterlson - Any reason I can't progress this adding type="example" and adjusting the CSS?
tjcrowder
commented
Sep 22, 2017
|
@bterlson - Any reason I can't progress this adding |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Sep 22, 2017
Collaborator
Add type="example" to what? It's already been added to all the <emu-grammar> elements that need it in spec.html.
|
Add |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tjcrowder
Sep 22, 2017
@jmdyck - Thanks. I did build the latest and saw the indentation is still off, my bad not checking for type="example" in the HTML. So it's just the CSS change to ecmarkup.css (e.g., css/elements.css in the ecmarkup repo) that needs doing then. I'll do an issue and PR for ecmarkup to do that (tiny change, but needs a lot of verification).
tjcrowder
commented
Sep 22, 2017
|
@jmdyck - Thanks. I did build the latest and saw the indentation is still off, my bad not checking for |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Sep 22, 2017
Member
@tjcrowder sorry I meant to get to this this week but failed. Yes, should be a tiny change now I hope.
|
@tjcrowder sorry I meant to get to this this week but failed. Yes, should be a tiny change now I hope. |




loganfsmyth commentedJul 25, 2017
In https://tc39.github.io/ecma262/#sec-object-initializer-runtime-semantics-evaluation, the second runtime evaluation rule for
ObjectLiteralis indented too much, which interrupts the alternating style of grammar rule followed by indented evaluation steps.Looks like the others have the
collapsedattribute, but it also looks questionable collapsed onto one line, so not sure what the right fix would be.