Brendan Eich wrote:
I don’t see the problem.

You're right, the example that wants function would need hoisting, e.g.:

function even(n) {
  return n === 0 || odd(abs(n) - 1);
}

function odd(n) {
  return n !== 0 && even(abs(n) - 1);
}

But even here, before the first call to either, you might arrange to bind even and odd before any call to either (including from within the other).

Still, the Web has code that relies on hoisting. At a minimum, it's pleasant in JS to be able to write a "literate program" in top-down order, with forward calls to later function declarations.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to