www.digitalmars.com         C & C++   DMDScript  

DMDScript - DMDScript 1.14

reply Walter Bright <newshound1 digitalmars.com> writes:
Closure bugs fixed

http://www.digitalmars.com/dscript/changelog.html
Oct 05 2007
parent reply hax <hax.sfo gmail.com> writes:
Cool. Closure seems work.

But there are still some bugs. Hope you could fix them in next release.

1. Not support multi-line string literal

var x = "a \
string";

assert (x == 'a string');

2. Can't call function expression directly

void function () {
	print('void function(){}()');
}();

(function () {
	print('(function(){})()');
})()

3. Not support function declaration in with statement
var x = 1;
with ({x:2}) {
  function f() { print(x) }
}

Yes, strictly speaking, it's a illegal code as spec, but most engines are
tolerant
of it.
SpiderMonkey and KJS/JavaScriptCore will just treat it as var f =
function(){...}
 This is my recommend behavior.
JScript and Opera will just treat it as normal function declaration and ignore
the
with scope (f() will return 1).
Oct 14 2007
next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
Thanks for taking the time to prepare the very useful bug report.
Oct 24 2007
prev sibling parent Dan <murpsoft hotmail.com> writes:
Wow... with all these odd usages I'm sure you'll find a gazillion
major bugs with my implementation when it's done.

Mine does a number of things internally that violate spec for
performance and elegance reasons.

I've been talking to Brendan Eich (the original guy who "invented"
JavaScript) about it and I've been trying to push him to just make
one spurious 2.0 release to get the ball rolling.

I suggested we:
fix Date (use properties instead of get/set methods)
use ISO 8701 (that right?) Dates for Date.parse()
move eval, parseInt, parseFloat etc to String.prototype
upgrade to modern RegExp
allow functions without brackets if they're single-statement
make no semi-colon the default, but allow it as a statement
terminator.

Thoughts?
Nov 29 2007