DMDScript - DMDScript 1.15 bugs
- Asen Bozhilov (74/74) Feb 26 2010 Is there bug tracking system, in which i can post bug reports for
- Walter Bright (5/7) Mar 11 2010 For the D version:
- Walter Bright (4/15) Mar 11 2010 Actually,
Is there bug tracking system, in which i can post bug reports for DMDScript? DMDScript 1.15 miss some parts from ECMA 262 standard. I want to report these case in bug tracker, but i didn't found. However I'll post here. DMDScript implementation isn't support Named Function Expression. DMDScript threat NFE as Function Declaration and define NFE on entering on execution context, instead of during evaluation of expression. print(typeof f); //function (function f(){}); It is bug. This bug can observe and in JScript implementation. ECMA 262 r3 define explicitly behavior for that case: | The production FunctionExpression : function Identifier ( | FormalParameterList opt) { FunctionBody } evaluated as follows: | 1. Create a new object as if by the expression newObject(). | 2. Add Result(1) to the front of the scope chain. | 3. Create a new Function object as specified in section 13.2 with | parameters specified by FormalParameterList opt | and body specified by FunctionBody. Pass in the scope chain of the | running execution context as the Scope. | 4. Create a property in the object Result(1). The property's name is | Identifier, value is Result(3), and attributes are | { DontDelete, ReadOnly }. | 5. Remove Result(1) from the front of the scope chain. | 6. Return Result(3). In DMDScript `Identifier Resolution`, never return type Reference in which `base' property has primitive value `null'. print(x); //undefined Identifier resolution specified in: | 10.1.4 Scope Chain and Identifier Resolution | 1. Get the next object in the scope chain. If there isn't one, go to | step 5. | 2. Call the [[HasProperty]] method of Result(1), passing the | Identifier as the property. | 3. If Result(2) is true, return a value of type Reference whose base | object is Result(1) and whose property name is the Identifier. | 4. Go to step 1. | 5. Return a value of type Reference whose base object is null and | whose property name is the Identifier. And internal GetValue(Reference) throw ReferenceError if `base' is `null'. | 8.7.1 GetValue (V) | 1. If Type(V) is not Reference, return V. | 2. Call GetBase(V). | 3. If Result(2) is null, throw a ReferenceError exception. | 4. Call the [[Get]] method of Result(2), passing GetPropertyName(V) | for the property name. | 5. Return Result(4). So this case in DMDScript is bug, related with specified behavior from ECMA 262. In old version DMDScript use Activation Object, which has [[Prototype]] property, which refer Object.prototype. ECMA 262, isn't specified implementation of Activation Object, but this allow to pollute Scope Chain. This notice isn't figure in change log of DMDScript 1.15 In DMDScript 1.15, still isn't valid syntax: (function() { })(); From which point of ECMA 262 grammar, that expression isn't valid? And why DMDScript 1.15 allow anonymous function to be a part from SourceElements? There only valid is FunctionDeclaration for which Identifier is compulsory. For example: function () { } Should be SyntaxError. Expression statement cannot start with `function`: | 12.4 Expression Statement | Syntax ExpressionStatement : | [lookahead {{,function}] Expression ; | Note that an ExpressionStatement cannot start with an opening curly | brace because that might make it ambiguous | with a Block. Also, an ExpressionStatement cannot start with the | function keyword because that might make it | ambiguous with a FunctionDeclaration. I hope, this feedback to improve DMDScript, because i used for stand alone shell. And i test in DMDScript for various things. And i like it, because in some case strict follow ECMA 262 standard. Regards.
Feb 26 2010
Asen Bozhilov wrote:Is there bug tracking system, in which i can post bug reports for DMDScript?For the D version: http://d.puremagic.com/issues/ For the C++ version: http://bugzilla.digitalmars.com/issues/
Mar 11 2010
Walter Bright wrote:Asen Bozhilov wrote:Actually, http://bugzilla.digitalmars.com/issues/ for both.Is there bug tracking system, in which i can post bug reports for DMDScript?For the D version: http://d.puremagic.com/issues/ For the C++ version: http://bugzilla.digitalmars.com/issues/
Mar 11 2010