VK said:
Do you have any other one besides Opera 9?
Yes. Not reporting this syntax error as a syntax error appears to be the
exception (unsurprisingly).
I have no idea about Safari,
but I would like to dismiss it right away
Which brings us back to what I said earlier. You write code without
recognising a syntax error in the language you are using and then when
your scripts only work in a couple of browsers at most you blame the
browsers. That the fault here is yours rather than the browser's is
obvious as soon as you realise that people exist who do manage to write
effective code for Safari. You think they are doing that by putting
disproportionate effort into the task, but it is more likely that they
are just presenting Safari with code devoid of syntax errors, mystical
incantations and your other nonsense, and the result just works.
(in case if): if you take a dring every time this
UA does something right with
scripting, you'll end up thirsty and angry
The VK definition of what is "right" is too detached from reality for
that to be a criteria for judging anything.
Any other mainstream browser?
Earlier today it was "Any ECMAScript-compliant engine erroring out on the
below, please", but now that it should be obvious that
ECMAScript-compliant browsers are likely to generate syntax errors with
code that contains syntax errors you want to retreat to your 'safe'
ground of "mainstream browsers". Which presumably is "mainstream
browsers" as defined by VK, and so pretty much Windows IE and Firefox
only.
A good hint: if you're in dubts about something, check it
on Netscape 4.7
Idiot.
In 99% of cases whatever it does is what was really
intended,
Unlikely as Netscape 4.7 implemented ECMA 262 2nd Edition (with
extensions) and your "mainstream browsers" (and other current scriptable
browsers) implement ECMA 262, 3rd Edition.
if it contradicts to ECMAScript specs it simply means
that the free-lancers
Have you looked at the list of the people who wrote ECMA 262?
failed to describe properly what they've seen.
With the contributors to ECMA 262 having direct access to the source code
for both JavaScript(tm) and JScript it is unlikely that observation
determined their behaviour.
One more time: there is not syntax error here,
Only when "here" is restricted to the contents of your deranged mind.
but there is Opera's parser laziness:
It is not lazy to report a syntax error when one is seen.
instead of further interprete the source and to
understand that this is an expression w/o assignment:
There is nothing in the language's syntax that allows such an
interpretation, and you cannot assume that any browser that does not
report the syntax error is making such an interpretation. As far as you
know they are just recognising the futility of the construct and just
filtering it out. Indeed experimentation suggests that the syntax error
is being filtered out rather than being interpreted as a Function
Expression. Try:-
<html>
<head>
<title></title>
<script type="text/javascript">
var a;
function(){alert('I was recognised 1');}
(a);
var b = function(){alert('I was recognised 2');}
(a);
</script>
</head>
<body>
</body>
</html>
- in Firefox and IE 6 and you see "I was recognised 2" alerted by the
second function expression but no sign of 'I was recognised 1', which
would be the consequences of the - function(){alert('I was recognised
1');} - line being interpreted as a function expression, as can be
illustrated by wrapping that line in parenthesise to give:-
<html>
<head>
<title></title>
<script type="text/javascript">
var a;
(function(){alert('I was recognised 1');})
(a);
var b = function(){alert('I was recognised 2');}
(a);
</script>
</head>
<body>
</body>
</html>
- where the absence of any syntax error allows both 'I was recognised 1'
and 'I was recognised 2' to be alerted.
So " interprete the source and to understand that this is an expression
w/o assignment" is not what Firefox or IE are doing with the syntax
error. Instead they appear to be silently ignoring it. And silently
ignoring syntax errors is less useful than reporting them.
instead of that
it just errors out on the first opportunity.
Which tells the programmer at the earliest point possible that they have
made an error.
Obviously you would not appreciate that, as you don't like being told
that you have made an error, and prefer not to recognise them when you
have. But then that is one of the things makes you by far the worst
programmer I have ever encountered.
Richard.