f ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jorge

    f ?

    <html><head><ti tle>f ?</title><script>
    window.onload= function () {
    var a= 0;

    function f () { alert("cero") };

    if (a === 1) {
    function f () { alert("uno") };
    } else if (a === 2) {
    function f () { alert("dos") };
    } else if (a === 3) {
    var f= function () { alert("tres") };
    }

    f();
    };
    </script></head><body></body></html>

    (FF2, FF3) -cero.
    (Safari, Opera, IE) -dos.

    --Jorge.
  • Jorge

    #2
    Re: f ?

    <html><head><ti tle>What is f ?</title><script>
    window.onload= function () {
    (function (f) {

    if (false) {
    function f () { alert("uno") };
    }
    f();

    })(function () { alert("dos") });
    };
    </script></head><body></body></html>

    (FF2, FF3) -dos.
    (Safari, Opera, IE) -uno.

    --Jorge.

    Comment

    • Jorge

      #3
      Re: f ?

      On Jul 20, 6:32 pm, "Richard Cornford" <Rich...@litote s.demon.co.uk>
      wrote:
      >
      If you want to ask a question putting that question in the form of words
      will make the situation a lot clearer (a real subject lien that states
      the subject of your posts is also a good idea).
      Still, you got it perfectly. Now it's clear as an unmodied lake.

      Hopefully there won't be many more gaps in forthcoming ECMAScript
      specification(s ).

      Thank you,
      --Jorge.

      Comment

      • Richard Cornford

        #4
        Re: f ?

        Jorge wrote:
        >On Jul 20, 6:32 pm, Richard Cornford wrote:
        >If you want to ask a question putting that question in the form
        >of words will make the situation a lot clearer (a real subject
        >lien that states the subject of your posts is also a good idea).
        Still, you got it perfectly. Now it's clear as an unmodied lake.
        But do you expect to be given the same leeway after you have been
        warned?
        Hopefully there won't be many more gaps in forthcoming ECMAScript
        specification(s ).
        There will be thousand of similar possible syntax constructs that have
        no specified meaning in the new specifications, and there will be
        explicit provision for syntax extensions. Brendan Eich sees extensions
        as a good thing and nobody has argued a strong counter-case yet. And the
        fact that we have been coping with syntax extensions for the past decade
        or more suggest that they are not such a bad thing. Many developments in
        the language (such as function expressions) appear to have started out
        as syntax extensions that were later formalised.

        And the specific issue of 'out of context' function declarations is to
        be left precisely as it is now in the ES3.1 spec (except for its
        'strict/cautious' mode where it is proposed that multiple declarations
        of like-named functions within a single scope will generate an error
        when compiled (although it is possible that such a restriction will not
        be applied if those declarations appear in a location where the spec
        does not allow them (the spec cannot specify the handling of unspecified
        constructs))). There is no desire to formalise either of the existing
        syntax extensions, and that would declare the other existing possibility
        as being formally 'incorrect'.

        Richard.

        Comment

        Working...