Alternative syntax for <|
Erik Arvidsson
erik.arvidsson at gmail.com
Wed Nov 16 11:45:08 PST 2011
On Wed, Nov 16, 2011 at 11:29, Andreas Rossberg <rossberg at google.com> wrote:
> On 16 November 2011 20:12, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:
>> One thing that all of these discussions are missing is the hoisting
>> property of function and any possible future classes. If we use "let
>> Point = ..." we lose all hoisting and the order of your declarations
>> starts to matter and we will end up in the C mess where forward
>> references do not work.
>
> The order of let declarations does not matter for visibility. It is
> perfectly fine to forward reference let, as long as it does not
> immediately require the value. For example:
>
> let x = {f: function() { return y;}}
> let y = 5
>
> In particular, this enables mutually recursive let definitions.
Sorry for being too brief. Today the following works.
f();
...
function f() { ... }
but the following does not:
f();
...
let f = function f() {};
I think it is important that we keep the forward reference behavior
with classes. This requires a declarative way of defining classes.
--
erik
More information about the es-discuss
mailing list