To say precisely we have to analyze the source codes of the
implementation;
Looking at implementat6ion source code is always an option, but the
odds are you will end up finding out that one does one thing and
another does another, so there aren't many generalisations to be made
from that source.
although, it also seems to me logical if some implementation
makes optimizations based even on parsing stage.
Yes, I didn't mean to imply that only compilation would be context
sensitive.
Yes, moreover, the most general purpose of a function expression
to be used in an expression, e.g. as an functional argument for
some higher-order function (relating e.g to the lambda calculus),
and _do not pollute the outer variable object/environment record_.
In contrast a function declaration from this position -- is just
a casual subroutine for a code reuse and encapsulating/abstracting
some actions. But seems, some once have seen that "coolness" can
use FE everywhere. Well, they are free to do that, that their
choice. The only thing I want, that they understand why do they
use it and whether it is really needed to use exactly a function
expression.
Where the test for understanding would be their ability to explain why
the 'choices' were made (which pre-supposes that there was a choice
and that the code observed is no just the result of reproducing the
code of others without (fully) understanding it).
Yeah, I've heard something about it. Recent mailings also
provides some spec described in alternative syntax (lambda JS
if I remember correctly).
There was a proposal to take (strict mode) JS as defined in ES5 and
use that to define anything added in later specs. That avoids the
circular problem of needing to understand JS before being able to
study the spec in order to understand JS.
I am fairly sure we will not be seeing an ECMAScript specification
expressed in terms of ML (in my lifetime at least).
The idea to describe a spec on the language itself at least
deserves attention. Although, it is a bit odd -- we don't know
yet a language (we're reading a spec), but already see this
language in algorithm descriptions.
Yes, that is the circular problem I mentioned above.
In general, yes, an abstract algorithmic language (or even just
abstract algorithms) is enough for the technical spec for
implementers.
Which brings us back to the context free grammars, which work for
specifications but do impose limitations on how things can be
expressed and so do make introducing a FunctionStatement a lot more
complex then simply handling a FunctionDeclaration differently
depending on context.
(that would be a 'mailing list' ML, not a 'metalanguage' ML <URL:
http://en.wikipedia.org/wiki/ML_(programming_language) >)
Douglas Crockford was arguing that a spec should be
described that every JS programmer can understand it.
That is one of the things that worried me about the proposal to do the
spec in ML; that learning another programming language as a
prerequisite for understanding the spec is a little much to ask of the
average (and especially javascript) programmer.
That's a noble idea of course, but seems he forgets that a
technical spec -- is a technical spec (i.e. a requirements
specification), but isn't an interesting literary reading.
It shouldn't be too difficult for someone capable of (reasonably)
logical thought processes (which is pretty much necessary for an
effective programmer) and sufficiently familiar with the language in
which the text is written to eventually understand a technical
specification in detail. However, there are lots of things that could
be done (at minimum in terms of additional text explanation (of the
algorithms and their implications)) that could speed that process up.
Previous ECMA 262 versions have not been that easy to approach for a
newcomer, so there is plenty of room for improvement without asking
the result to come anywhere near 'an interesting literary read'.
Of course if there were any really decent (and in depth) books on
javascript then it may not be necessary for those seeking
understanding to go to the specification, and so much less need for an
understandable spec.
Although, some (including me) provides the alternative spec
description in more human view ...
<snip>
Javascript learning form the web suffers from two things; 1. There is
a mass of bogus information and very poor advice available on the web
(as there is less standing in the way of its publication than standing
in the way of bad books on the subject). 2. Almost any (Google, etc.)
search on the subject of javascript will be swamped in hits from pages
that contain NOSCRIPT elements declaring that "this page works best
with javascript enabled" (or the like).
It is nice that there are good resources available, but newcomers are
going to be hard pressed to tell the good from the bad.
The most parts of the spec help to understand how does something
work (again -- just an exact algorithm). But at the same time
the ECMAScript provides its own abstraction level, and exactly
ECMAScript programmers are not required to think about
_implementations details_. It could be easier to say them that
there is something called as a "variable hoisting" (a thinking
out simplified concept to understand the things), rather than,
"the handling of the execution context code is divided on two
stages: the entering the context and the code execution, and all
data (vars, FD, formal parameters) are created at the first stage --
that's why they are available before the definition in the source
code position".
The name of the thing ("variable hoisting" in this case) is of limited
use without knowing what that thing does (or how it works), so the
explanation still needs to be somewhere.
Yes, it will be interesting to see the outcome, although, we
already can see some implementation on JS -- Narcissus -- there
all that algorithms are described very interesting on JavaScript.
Javascript implementations written in javascript raise some
interesting questions. Narcissus uses javascript regular expressions
to implement its regular expressions. Take that to its extreme and
Narcissus stops existing, and you run the code it would be executing
in Narcissus is the javascript engine that would otherwise be running
Narcissus. Go the other way and insist that Narcissus provide an
implementation for everything (regular expressions, primitives,
representations of IEEE double precision numbers, math operations on
those reprehensions, etc., etc.) and you are asking more of that
implementation than of any other.
Richard.