📄 errorsandtypos.htm
字号:
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta name="generator" content="XSL Transform" />
<title></title><meta name="author" content="Jon Jagger" />
<link rel="stylesheet" href="ecma334.css"></link>
</head>
<body>
<div align="right"><i><a href="http://www.jaggersoft.com">Jon Jagger</a></i></div>
<div align="right"><a href="mailto:jon@jaggersoft.com">jon@jaggersoft.com</a></div>
<br>
</br>
</span><span class="ruler">
<span class="heading">ECMA-334: Errors, Typos and Notes</span>
<h2>Errors?</h2>
<p>
In the HTML presentation I have <i>not</i> corrected these.
</p>
<p>
<a href="9.3.2.htm">10.3.2</a> Comments
</br>
The grammar production for delimited-comment-character
is incorrect. In a comment with two * before the closing /
(/* eg **/) the second production will eat <i>both</i>
asterisks, and thus miss the trailing /. The not-slash
of the second production is really a condition.
</p>
<p>
<a href="10.3.htm">10.3</a> Declarations.
</br>
This clause does not appear to specify the declaration space of
a local constant declaration (neither does
<a href="15.5.2.htm">15.5.2</a>)
</p>
<p>
<a href="10.4.3.htm">10.4.3</a> Enumeration members.
</br>
The clause says the member of an enumeration are the constants
declared in the enumeration and the members inherited from
class <i>object</i>. Should this be System.Enum rather than object?
</p>
<p>
<a href="12.3.1.htm">12.3.1</a> Initially assigned variables.
</br>
I think a variable declared in a using statement is also initially assigned.
</p>
<p>
<a href="12.3.3.12.htm">12.3.3.12</a> Return statements.
</br>
The definite assignment state for a return statement with no
expression (viz return;) is not covered.
</p>
<p>
<a href="12.3.3.15.htm">12.3.3.15</a> Try-catch-finally statements.
</br>
In the code example, the goto statement:
<pre> goto LABEL:</pre>
needs to be
<pre> goto LABEL;</pre>
Also, the labeled-statement:
<pre>LABEL:</pre>
needs to be
<pre>LABEL:;</pre>
</p>
<p>
<a href="14.4.1.htm">14.4.1</a> Argument lists
</br>
Paragraph 2, sentence 1 states that the arguments of an indexer
<a href="17.8.htm">17.8</a> are always
passed as value parameters <a href="17.5.1.1.htm">17.5.1.1</a>.
However, Paragraph 6, sentence 1 states that indexers may declare
their right most parameters to be parameter array
<a href="17.5.1.4.htm">17.5.1.4</a>.
These two sentences appear to be contradictory because
<a href="17.5.1.htm">17.5.1</a> (Paragraph 7) states that
value parameters and parameter arrays are different.
Note also that <a href="10.6.htm">10.6</a> (Paragraph 1, 3rd list item)
does not mention whether the signature of an indexer includes a params
array (yet it is mentioned in the first two list items about methods and
instance constructors).
The grammar for an indexer permits a params modifier (whereas,
for example, the grammar for an operator does not).
The Microsoft C# compiler permits a params modifier on an indexer.
</p>
<p>
<a href="14.5.htm">14.5</a> Primary expressions.
</br>
In the grammar production for <i>primary-no-array-creation-expression</i>
I think the production
<i>sizeof-expression</i>
should only be allowed in unsafe
code (see <a href="25.5.8.htm">25.5.8</a>).
</p>
<p>
<a href="14.5.2.1.htm">14.5.2.1</a> Invariant meaning in blocks
</br>
Paragraph 1, sentences 1 and 2 read
"For each occurrence of a given identifier as a simple-name in
an expression, every other occurrence of the same identifier as a
simple-name in an expression within the immediately enclosing
block or switch-block must refer to the same
entity. This rule ensures that the meaning of a name in the context of
an expression is always the same within a block."</br>
The spec then contains the following example (not in an
[Example: and so presumably normative)
<pre>
class Test
{
double x;
void F(bool b) {
x = 1.0;
if (b) {
int x = 1;
}
}
}
</pre>
and claims this results in a compile-time error.
The intent may be that the example should result in a compile-time
error (and it does in the Microsoft compiler)
but the third occurrence of x occurs in a
<i>declarator</i> and not in an <i>expression</i> (as specified in
sentence 1).
</p>
<p>
<a href="14.6.htm">14.6</a> Unary expressions.
</br>
In the grammar production for <i>unary-expression</i>
I think the productions
<i>* unary-expression</i> and <i>& unary-expression</i>
should only be allowed in unsafe
code (see <a href="25.5.1.htm">25.5.1</a> and
<a href="25.5.4.htm">25.5.4</a>).
</p>
<p>
<a href="15.8.4.htm">15.8.4</a> The foreach statement.
</br>
In paragraph 7, sentence 2, think the type of the local variable enumerator
be <b>E</b> and not <b>Enumerator</b> (see paragraph 4, sentence 2).
</p>
<p>
<a href="17.5.1.htm">17.5.1</a> Method parameters.
</br>
Paragraph 5, sentence 4 reads</br>
"Thus it is a compile-time error for a parameter or local variable to
have the same name as another parameter or local variable."</br>
Is this correct? Other clauses (eg <a href="10.3.htm">10.3, paragraph 4, Note,
class A</a>) state that a conforming program can declare two local variables
in a method block as long they are in non-overlapping nested blocks.
</p>
<p>
<a href="17.5.4.htm">17.5.4</a> Override methods.
</br>
Paragraph 1, sentence 2 reads "An override method overrides
an inherited virtual method with the same <i>signature</i>."</br>
The signature does not include the return type and I
can find nothing in this clause on the relationship between
the return type of the overridden base method and the override
method. This also affects
<a href="17.5.5.htm">17.5.5</a> (Sealed methods) and
<a href="17.5.6.htm">17.5.6</a> (Abstract methods).
</p>
<p>
<a href="17.6.2.htm">17.6.2</a> Accessors.
</br>
Paragraph 1, sentence 6 reads</br>
"Since a set accessor implicitly has a parameter named
value, it is a compile time error for a local variable declaration
in a set accessor to have that name."</br>
Presumably it is also a compile-time error to have a
local constant declaration named value in a set accessor.
</p>
<p>
<a href="17.7.2.htm">17.7.2</a> Event accessors.
</br>
Paragraph 5, sentence 1 reads</br>
"Since an event accessor implicitly has a parameter named value,
it is a compile-time error for a local variable declared
in an event accessor to have that name."</br>
Presumably it is also a compile time error to have a
local constant declaration named value in an event accessor.
</p>
<p>
<a href="20.2.5.htm">20.2.5</a> Interface member access
</br>
Paragraph 1, sentence 1 contains the words
"...where I is an instance of an interface type...".
but you cannot create instances of interface types.
</p>
<p>
<a href="24.2.htm">24.2</a> Attribute specification.
</br>
Paragraph 2. In the grammar productions for global-attribute-section and
attribute-section there are productions that end</br>
<b>,]</b>
<br>and not<br>
<b>,</b> <b>]</b>
<br>implying you cannot separate the <b>,</b> and the <b>]</b>
with whitespace.
</p>
<p>
<a href="24.2.htm">24.2</a> Attribute specification.
</br>
Paragraph 1, sentence 3. Fails to say that attributes can
be specified for struct-member-declarations.
</p>
<p>
<a href="24.2.htm">24.2</a> Attribute specification.
</br>
Paragraph 2.
The <i>attribute-target</i> productions does not include <b>module</b>
(but it does in appendix A).
</p>
<p>
<a href="24.4.2.htm">24.4.2</a> The Conditional attribute.
</br>
Paragraph 2, first list item. Fails to say that the conditional
method can be a method in a struct-declaration.
</p>
<p>
A.1.7 Keywords.
</br>
The keyword <b>volatile</b> is not in the table (but it is in
<a href="9.4.3.htm">9.4.3</a>).
</p>
<p>
A.2.4 Expressions.
</br>
In the grammar production for <i>unary-expression</i>
I think the production <i>* unary-expression</i> should only be allowed in
unsafe code (see P364, L11).
</p>
<h2>Typos</h2>
<p>
In the HTML presentation I <i>have</i> corrected these typos
(mostly).
</p>
<p>
<a href="8.5.htm">8.5</a> Expressions.
</br>
The table is missing two section numbers. Unary operators are covered in
clause <a href="14.6.htm">14.6</a>. Shift operators are covered
in clause <a href="14.8.htm">14.8</a>.
</p>
<p>
<a href="8.7.4.htm">8.7.4</a> Properties.
</br>
Pedantically, the code example won't compile because Repaint
cannot be resolved. Some ... for ellision maybe?
</p>
<p>
<a href="8.10.htm">8.10</a> Delegates.
</br>
In the code fragment the <b>for</b> statement is missing a left brace.
</p>
<p>
<a href="9.4.2.htm">9.4.2</a> Identifiers.
</br>
Paragraph 1, sentence 1.
language), should be language).
</p>
<p>
<a href="9.4.4.5.htm">9.4.4.5</a> String literals.
</br>
In the grammar production for the non-terminal <i>verbatim-string-literal</i>
there is a spurious space between <i>verbatim</i> and
<i>-string-literal-characters</i><sub>opt</sub>
</p>
<p>
<a href="9.4.4.5.htm">9.4.4.5</a> String literals.
</br>
The grammar production for the non-terminal
<i>single-verbatim-string-literal-character</i>, the
rhs starts with the word <b>any</b> (with a lowercase a) and
in all other similar cases it is <b>Any</b> (with an uppercase A).
</p>
<p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -