![]() | |
#11
| |||
| |||
|
|
You have yet to understand what it means when something is called an ECMAScript implementation. *But as you insist, I am not going to prevent you making a fool out of yourself. Score adjusted |
#12
| |||
| |||
|
|
but they do not go into resulting execution code |
#13
| |||
| |||
|
|
You have yet to understand what it means when something is called an ECMAScript implementation. But as you insist, I am not going to prevent you making a fool out of yourself. Score adjusted |
#14
| |||
| |||
|
|
You have yet to understand what it means when something is called an ECMAScript implementation. But as you insist, I am not going to prevent you making a fool out of yourself. Score adjusted I understand exactly what it means Thomas. |
|
Do you spend your whole day being a presumptuous ass, [...] |
#15
| |||
| |||
|
|
but they do not go into resulting execution code Which would explain the behavior of the eval function in this case. Thanks VK for your insightful and knowledgeable post and for actually addressing the OP's question. |
#16
| |||||
| |||||
|
|
No, you don't. |
|
If you did, you would not only have recognized section 2 of the ECMAScript Specification |
|
You have yet to understand what it means when something is called an ECMAScript implementation. |
|
but also the number of differences between the implementations that result from that, |
|
All engines I tried (Rhino, FF and Konqueror) however return '3', as if the the evaled body was in a block. (According to 12.1 inside a block the last statement not returning 'empty' is used as return value). Thomas I leave that to people who are more skilled in it. |
#17
| |||
| |||
|
|
According to the spec Section 14 the production SourceElements:SourceElements SourceElement is evaluated as follows: 1. Evaluate SourceElements. 2. If Result(1) is an abrupt completion, return Result(1) 3. Evaluate SourceElement. 4. Return Result(3). If I understood correctly the following program should alert 'undefined': alert(eval('3;;')); The last source-element would be ";" (the empty statement), and this statement returns 'empty' as value (12.3) which is then transformed to 'undefined' by the eval (15.1.2.1). All engines I tried (Rhino, FF and Konqueror) however return '3', as if the the evaled body was in a block. (According to 12.1 inside a block the last statement not returning 'empty' is used as return value). Is this a bug in these engines, or did I misinterpret the spec? snip |
#18
| |||
| |||
|
|
Another question for VariableDeclarations: Why does the production 'VariableDeclaration: Identifier' and the production 'VariableDeclaration: Identifier Initialiser' return a sequence of characters? I can't find how these strings could be used. |
#19
| |||
| |||
|
|
If you are referring to "12.3 Empty Statement" then this is plain bs to disregard: it shows nothing but poor understanding by authors the subject they had to write on. Obviously they considered the semicolon as some kind of "statement" or "statement formant", other words something that exists or leaves some signs *at runtime* so to be "evaluated". Again: the JavaScript production is semi-similar - in the most generic sense of course - to Java. In Java we have raw source as .java file and .class bytecode parsed out of the raw source to be served to the client. Client-side this intermediary bytecode finally gets converted to the machine execution code. JavaScript is served as raw source right away to client and "bytecode" (sequence of tokens) is being made client-side right on arrival. No attempt to execute this code is made on this stage, the parser is only cares if a valid sequence of valid tokens can be made from the received source. If any error on this stage then one gets one of syntax errors. Semicolons do participate in this stage by helping to extract tokens from the source but they do not go into resulting execution code - lets keep calling it "bytecode" though formally it is not a correct term. This way there is not any EmptyExpression to be "evaluated". snip |
#20
| |||
| |||
|
|
Here's an example that destroys VK's argument : if (x) ; else x = 3; The lonely semicolon must be translated into code that jumps over the 'else' part. It can't be thrown away by the parser and forgotten. |
|
Incidentally, that semicolon can't be left out. If you want to do nothing you have to write the semicolon to show you really mean it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |