JavaScript ECMAScript definitions

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

    #16
    Re: JavaScript ECMAScript definitions

    On Mon, 03 May 2004 17:49:58 -0400, Randy Webb
    <hikksnotathome @aol.com> wrote:
    [color=blue]
    >Thomas 'PointedEars' Lahn wrote:[color=green]
    >> Jim Ley wrote:
    >>[color=darkred]
    >>>Thomas 'PointedEars' Lahn wrote:
    >>>
    >>>>Jim Ley wrote: Two obvious reasons: For example, I know of versions of
    >>>>JScript which yield a script error even if one only tests *if* a
    >>>>property exists.
    >>>
    >>>Sure, but I know of the same in SpiderMonkey impls.[/color]
    >>
    >>
    >> And that is a *serious* violation of the ECMAScript specification.[/color][/color]

    Well sure, PIE isn't conformant - hardly news there. (the error also
    only manifests itself with host objects, so it's hardly deadly in the
    real world, and it doesn't happen on real browsers.)
    [color=blue]
    >ECMA is a recommendation and nothing more. It reminds me of the W3C.[/color]

    No, unlike the W3C stuff, ECMAScript is a proper International
    standard. again there's good reasons for not worrying about \b in
    regexps or \ at the end of line or the other minor non-conformances
    though, and the various ES impl's are very much more conformant than
    anything else we get to play with.

    (I still don't understand Thomas's point about function literals, all
    I can see is a complaint against JScript's documentation since "it
    works".

    Jim.


    --
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    • Lasse Reichstein Nielsen

      #17
      Re: JavaScript ECMAScript definitions

      Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
      [color=blue]
      > No anonymous functions with "function" keyword and without identifier
      > are specified in ECMAScript. JavaScript calls this a "function"
      > operator. JScript does not specify this at all, yet it works.[/color]

      You are distinguishing between the documentation of JScript and the
      actual implementation. The implementation is ECMAScript conformant.
      The documentation is flawed.

      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      • Thomas 'PointedEars' Lahn

        #18
        Re: JavaScript ECMAScript definitions

        Lasse Reichstein Nielsen wrote:
        [color=blue]
        > Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:[color=green]
        >> No anonymous functions with "function" keyword and without identifier
        >> are specified in ECMAScript. JavaScript calls this a "function"
        >> operator. JScript does not specify this at all, yet it works.[/color]
        >
        > You are distinguishing between the documentation of JScript and the
        > actual implementation.[/color]

        Yes, I do.
        [color=blue]
        > The implementation is ECMAScript conformant.[/color]

        It is not, but the point is not the documentation issue but, for example,
        the property test issue. I am yet too see something specified that badly
        b0rken in JavaScript.
        [color=blue]
        > The documentation is flawed.[/color]

        Additionally, since it omits important features like this but ibid
        it is stated that JScript is an ECMAScript conforming implementation.


        PointedEars

        Comment

        • Lasse Reichstein Nielsen

          #19
          Re: JavaScript ECMAScript definitions

          Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
          [color=blue]
          > Lasse Reichstein Nielsen wrote:[color=green]
          >> The implementation is ECMAScript conformant.[/color]
          >
          > It is not, but the point is not the documentation issue but, for example,
          > the property test issue. I am yet too see something specified that badly
          > b0rken in JavaScript.[/color]

          Which test is that? If it is on a host object, then there is no
          guarantee that it should work.
          [color=blue][color=green]
          >> The documentation is flawed.[/color]
          >
          > Additionally, since it omits important features like this but ibid
          > it is stated that JScript is an ECMAScript conforming implementation.[/color]

          Well, what's the problem then? That says that function expressions
          work, even if it is not explicitly mentioned anywhere else in the
          JScript documentation. :)

          /L
          --
          Lasse Reichstein Nielsen - lrn@hotpop.com
          DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
          'Faith without judgement merely degrades the spirit divine.'

          Comment

          • Thomas 'PointedEars' Lahn

            #20
            Re: JavaScript ECMAScript definitions

            Lasse Reichstein Nielsen wrote:
            [color=blue]
            > Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:[color=green]
            >> Lasse Reichstein Nielsen wrote:[color=darkred]
            >>> The implementation is ECMAScript conformant.[/color]
            >> It is not, but the point is not the documentation issue but, for example,
            >> the property test issue. I am yet too see something specified that badly
            >> b0rken in JavaScript.[/color]
            >
            > Which test is that?[/color]

            I have never experienced such a behavior, only read of it (the
            discussion was about the problems of a generic DHTML library):

            ,-<bvc5q3$qh2ii$1 @ID-3551.news.uni-berlin.de>
            |
            | [...]
            | Rette mal bei IE4 auf dem Mac blind eine existierende Fenstereigensch aft,
            | der nicht zuvor ein Wert zugewiesen wurde. Dein Rettungsversuch endet mit
            | einer fehlermeldung. Du kannst auch nicht prüfen, ob es etwas zu retten
            | gibt. Allein die Prüfung verursacht schon einen fehler, wenn es nichts zu
            | retten gibt. Bei einem normalen Browser würdest Du einen eventiellen
            | error-Handler retten, Deinen eigenen konnektieren und dann innerhalb
            | Deines eigenen den geretteten aufrufen. Bei IE4 auf dem Mac geht das
            | nicht, wenn es nicht schon einen error-Handler gibt. Genau das aber kannst
            | Du nicht feststellen, ohne einen Fehler zu riskieren. Bugs dieser Art gibt
            | es massenhaft. [...]

            Translation:

            | [...]
            | With IE4 on the Mac, try to make a backup of an existing property of [a]
            | window that has not been assigned a value previously. Your trial results
            | in an error message. You cannot even check if there is something to back
            | up. The check itself results in an error if there is nothing to back up.
            | In a normal browser you would back up a possible error handler, connect
            | your own and then call the backed up one from yours. With IE4 on the
            | Mac this is impossible if there is not already an error handler. But
            | you cannot determine exactly this without risking an error. There are
            | a lot of bugs like this. [...]
            [color=blue]
            > If it is on a host object, then there is no guarantee that it should work.[/color]

            Wrong. Even host objects, if they provide an ECMAScript interface, need to
            exhibit ECMAScript compliant behavior. That is, for example, the mere test
            for a property must not result in a runtime error.


            PointedEars

            Comment

            • Lasse Reichstein Nielsen

              #21
              Re: JavaScript ECMAScript definitions

              Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
              [color=blue]
              > Translation:
              >
              > | [...]
              > | With IE4 on the Mac,[/color]

              (I am not sure what "an existing property ... that has not been
              assigne a value previously" is ... how do we know it exists if
              we haven't created it, and can't read it?).

              It's highly probable that a browser released in January 1998 doesn't
              implement ECMAScript v3, which was finalized in December 1999.
              In the same way, Netscape's JavaScript 1.2 wasn't ECMAScript compliant
              either.

              However, current versions of JavaScript and JScript are on the same
              level of ECMAScript conformance - almost perfect.

              [color=blue]
              > Wrong. Even host objects, if they provide an ECMAScript interface, need to
              > exhibit ECMAScript compliant behavior. That is, for example, the mere test
              > for a property must not result in a runtime error.[/color]

              No. ECMA 262 v3, section 8.6.2 says:
              ---
              Host objects may implement these internal methods with any
              implementation-dependent behaviour, or it may be that a host object
              implements only some internal methods and not others.
              ---
              where "these internal methods" includes [[Get]]. If [[Get]] is undefined,
              then merely testing for a property will give a runtime error.

              With host objects, all bets are off.
              /L
              --
              Lasse Reichstein Nielsen - lrn@hotpop.com
              DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
              'Faith without judgement merely degrades the spirit divine.'

              Comment

              • Thomas 'PointedEars' Lahn

                #22
                Re: JavaScript ECMAScript definitions

                Lasse Reichstein Nielsen wrote:
                [color=blue]
                > Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:[color=green]
                >> Translation:
                >> | [...]
                >> | With IE4 on the Mac,[/color]
                >
                > (I am not sure what "an existing property ... that has not been assigne a
                > value previously" is ... how do we know it exists if we haven't created
                > it, and can't read it?).[/color]

                We can write to it and see an effect, I suppose.
                [color=blue]
                > It's highly probable that a browser released in January 1998 doesn't
                > implement ECMAScript v3, which was finalized in December 1999. In the
                > same way, Netscape's JavaScript 1.2 wasn't ECMAScript compliant either.[/color]

                IE for Mac is using JScript which has always claimed to be ECMAScript compliant.
                [color=blue]
                > However, current versions of JavaScript and JScript are on the same level
                > of ECMAScript conformance - almost perfect.[/color]

                Well, I had wo workaround the same b0rken behavior with host objects in the
                current IE (JScript 5.6.x).
                [color=blue][color=green]
                >> Wrong. Even host objects, if they provide an ECMAScript interface,
                >> need to exhibit ECMAScript compliant behavior. That is, for example,
                >> the mere test for a property must not result in a runtime error.[/color]
                >
                > [...] If [[Get]] is undefined, then merely testing for a property will
                > give a runtime error.[/color]

                Not necessarily. AIUI the "typeof" operator does not call [[Get]] always:

                | 8.7 The Reference Type
                | [...]
                | GetBase(V). Returns the base object component of the reference V.
                | GetPropertyName (V). Returns the property name component of the
                | reference V.

                | 11.4.3 The typeof Operator
                |
                | The production UnaryExpression : typeof UnaryExpression is evaluated as
                | follows:
                |
                | 1. Evaluate UnaryExpression .
                | 2. If Type(Result(1)) is not Reference, go to step 4.
                ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^
                | 3. If GetBase(Result( 1)) is null, return "undefined" .
                ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^
                | 4. Call GetValue(Result (1)).
                ^^^^^^^^^^^^^^^ ^^^^^^^^^
                | 5. Return a string determined by Type(Result(4)) according to the
                | following table:
                | [...]

                | 8.7.1 GetValue (V)
                |
                | 1. If Type(V) is not Reference, return V.
                ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^
                | 2. Call GetBase(V).
                | 3. If Result(2) is null, throw a ReferenceError exception.
                ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^
                | 4. Call the [[Get]] method of Result(2), passing GetPropertyName (V)
                | for the property name.
                | 5. Return Result(4).

                But that operator is available since the first version of JScript:
                [color=blue]
                > With host objects, all bets are off.[/color]

                No, they are not, at least they *should not*.


                PointedEars

                Comment

                • Thomas 'PointedEars' Lahn

                  #23
                  Re: JavaScript ECMAScript definitions

                  Thomas 'Ingrid' Lahn wrote:
                  [color=blue]
                  > Lasse Reichstein Nielsen wrote:[color=green]
                  >> [...] If [[Get]] is undefined, then merely testing for a property will
                  >> give a runtime error.[/color]
                  >
                  > Not necessarily. AIUI the "typeof" operator does not call [[Get]] always:
                  > [...]
                  > But that operator is available since the first version of JScript:[/color]

                  <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/script56/html/js56jsoriversio ninformation.as p>


                  PointedEars

                  Comment

                  • Lasse Reichstein Nielsen

                    #24
                    Re: JavaScript ECMAScript definitions

                    Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
                    [color=blue][color=green]
                    >> (I am not sure what "an existing property ... that has not been assigne a
                    >> value previously" is ... how do we know it exists if we haven't created
                    >> it, and can't read it?).[/color]
                    >
                    > We can write to it and see an effect, I suppose.[/color]

                    You can also write to a nonexisting property. That alone doesn't
                    distinguish an existing property that has not been assigned a value
                    from a nonexisting property.

                    (I.e., I still haven't understood the actual problem).
                    [color=blue][color=green]
                    >> It's highly probable that a browser released in January 1998 doesn't
                    >> implement ECMAScript v3, which was finalized in December 1999. In the
                    >> same way, Netscape's JavaScript 1.2 wasn't ECMAScript compliant either.[/color]
                    >
                    > IE for Mac is using JScript which has always claimed to be
                    > ECMAScript compliant.[/color]

                    Which version of ECMAScript? IE 4/Mac will will probably be v2
                    compliant.
                    [color=blue][color=green]
                    >> [...] If [[Get]] is undefined, then merely testing for a property will
                    >> give a runtime error.[/color]
                    >
                    > Not necessarily. AIUI the "typeof" operator does not call [[Get]] always:[/color]

                    Yes, it won't need to use the [[Get]] method if
                    1) the value isn't a reference to a property, or
                    2) the reference has a base object that is null.

                    I highly doubt such a reference can be created programmaticall y,
                    without resorting to host objects. In any case, it will use [[Get]]
                    if it tries to test for a property of an actual object.
                    [color=blue]
                    > No, they are not, at least they *should not*.[/color]

                    I agree that they shouldn't be, but alas, the standard says they are.

                    You can not rely on *any* feature of a host object. It is valid
                    ECMAScript to have a host object with *no* internal properties,
                    including [[Get]]. It will fail in pretty much any expression you use
                    it in, but it's a valid ECMAScript host object.

                    /L
                    --
                    Lasse Reichstein Nielsen - lrn@hotpop.com
                    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                    'Faith without judgement merely degrades the spirit divine.'

                    Comment

                    • Thomas 'PointedEars' Lahn

                      #25
                      Re: JavaScript ECMAScript definitions

                      Lasse Reichstein Nielsen wrote:
                      [color=blue]
                      > Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:[color=green][color=darkred]
                      >>> (I am not sure what "an existing property ... that has not been assigne a
                      >>> value previously" is ... how do we know it exists if we haven't created
                      >>> it, and can't read it?).[/color]
                      >> We can write to it and see an effect, I suppose.[/color]
                      >
                      > You can also write to a nonexisting property. That alone doesn't
                      > distinguish an existing property that has not been assigned a value
                      > from a nonexisting property.[/color]

                      Correct.
                      [color=blue]
                      > (I.e., I still haven't understood the actual problem).[/color]

                      Yes, indeed. You asked "how do we know it exists if we haven't
                      created it, and can't read it?" and that was my reply.
                      [color=blue][color=green][color=darkred]
                      >>> It's highly probable that a browser released in January 1998 doesn't
                      >>> implement ECMAScript v3, which was finalized in December 1999. In the
                      >>> same way, Netscape's JavaScript 1.2 wasn't ECMAScript compliant either.[/color]
                      >> IE for Mac is using JScript which has always claimed to be
                      >> ECMAScript compliant.[/color]
                      >
                      > Which version of ECMAScript? IE 4/Mac will will probably be v2
                      > compliant.[/color]

                      So?
                      [color=blue][color=green][color=darkred]
                      >>> [...] If [[Get]] is undefined, then merely testing for a property will
                      >>> give a runtime error.[/color]
                      >>
                      >> Not necessarily. AIUI the "typeof" operator does not call [[Get]] always:[/color]
                      >
                      > Yes, it won't need to use the [[Get]] method if
                      > 1) the value isn't a reference to a property, or[/color]

                      That's exactly the point.
                      [color=blue]
                      > 2) the reference has a base object that is null.
                      >
                      > I highly doubt such a reference can be created programmaticall y,[/color]

                      Well, it can. The mere "typeof" test for a property must not result in a
                      script error if that property does not exist since [[Get]] is not called
                      and no other object-dependent methods are involved. But it *does* in the
                      mentioned versions of IE and JScript, and it certainly does with certain
                      recent IE host objects (which is why I had to exclude the test for certain
                      properties in my ObjectInspector , to get it straight).
                      [color=blue]
                      > without resorting to host objects.[/color]

                      I do not know for sure, need to check my code first.
                      [color=blue]
                      > In any case, it will use [[Get]] if it tries to test for a property of
                      > an actual object.[/color]

                      Of course. But it must not trigger an error if the property
                      does not exist and we test for the property with "typeof".
                      [color=blue][color=green]
                      >> No, they are not, at least they *should not*.[/color]
                      >
                      > I agree that they shouldn't be, but alas, the standard says they are.[/color]

                      They are not.
                      [color=blue]
                      > You can not rely on *any* feature of a host object. It is valid
                      > ECMAScript to have a host object with *no* internal properties,
                      > including [[Get]]. It will fail in pretty much any expression you use
                      > it in, but it's a valid ECMAScript host object.[/color]

                      No. If I test for properties with "typeof" and this property does not
                      exist, an ECMAScript compliant object/implementation would not trigger
                      a script error.


                      PointedEars

                      Comment

                      • Lasse Reichstein Nielsen

                        #26
                        Re: JavaScript ECMAScript definitions

                        Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:
                        [color=blue][color=green]
                        >> In any case, it will use [[Get]] if it tries to test for a property of
                        >> an actual object.[/color][/color]
                        [color=blue]
                        > Of course. But it must not trigger an error if the property
                        > does not exist and we test for the property with "typeof".[/color]

                        Yes it must, by the specification of typeof.

                        If the argument to typeof, call it V, is a Reference Type
                        (q.v. section 8.7), where the value of GetBase(V) is a non-null host
                        object, GetPropertyName (V) is "foo", and where the [[Get]] property of
                        that host object throws an exception when called with the argument
                        "foo", then it will fail.

                        The sequence of execution is:

                        In step 4 of the typeof operator, it will call getValue on the
                        paramter. In step 4 of getValue, the [[Get]] function is called
                        on the host object, throwing an exception.


                        (I did say that host objects didn't need to implement [[Get]]. That's
                        not true. The [[Get]] method can, however, act "in any manner").

                        [color=blue]
                        > No. If I test for properties with "typeof" and this property does not
                        > exist, an ECMAScript compliant object/implementation would not trigger
                        > a script error.[/color]

                        For host objects, the object decides what "does not exist" means. It can
                        implement [[Get]] and [[HasProperty]] inconsistently (failing on [[Get]]
                        but returning true on [[HasProperty]] for the same property name).

                        The typeof operator use getValue, which uses [[Get]], which can be made
                        to fail for a host object. It would be stupid, but it's valid.

                        /L
                        --
                        Lasse Reichstein Nielsen - lrn@hotpop.com
                        DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                        'Faith without judgement merely degrades the spirit divine.'

                        Comment

                        • Richard Cornford

                          #27
                          Re: JavaScript ECMAScript definitions

                          Thomas 'PointedEars' Lahn wrote:[color=blue]
                          > Lasse Reichstein Nielsen wrote:[/color]
                          <snip>[color=blue][color=green]
                          >> You can not rely on *any* feature of a host object. It is valid
                          >> ECMAScript to have a host object with *no* internal properties,
                          >> including [[Get]]. It will fail in pretty much any expression you use
                          >> it in, but it's a valid ECMAScript host object.[/color]
                          >
                          > No. If I test for properties with "typeof" and this property does not
                          > exist, an ECMAScript compliant object/implementation would not trigger
                          > a script error.[/color]

                          When a typeof test generates an error while reading a property of a host
                          object it seems unlikely that the property does not exist. I would
                          conclude that a typeof test on a named property of a host object that
                          generates an error (or crashes the browser) indicated that the property
                          did refer to something, but that the something referred to was
                          sufficiently unusual that attempting to use it caused problems.

                          But Mozilla suffers from this pro0blem as much as IE does (and most over
                          browsers); Try examining the properties of the global JavaClass and
                          JavaPackage objects.

                          Richard.


                          Comment

                          • Thomas 'PointedEars' Lahn

                            #28
                            Re: JavaScript ECMAScript definitions

                            Lasse Reichstein Nielsen wrote:[color=blue]
                            > The typeof operator use getValue, which uses [[Get]],[/color]

                            But not *always* which is the point you still do not seem to see.
                            [color=blue]
                            > which can be made to fail for a host object. It would be stupid, but
                            > it's valid.[/color]

                            1. In section 5.2:

                            Result(n) is *not* an implementation/object dependent method:
                            "The notation Result(n) is used as shorthand for 'the result
                            of step n'."

                            Type() is *not* an implementation/object dependent method:
                            "Type(x) is used as shorthand for 'the type of x'".

                            2. In section 8.7:
                            "A Reference is a reference to a property of an object.
                            A Reference consists of two components, the base object
                            and the property name."

                            3. In section 11.4.3 (on how the "typeof" operation is evaluated):
                            "1. Evaluate UnaryExpression .
                            2. If Type(Result(1)) is not Reference, go to step 4."

                            That would apply to a property that does not exist.

                            4. Ibid: "4. Call GetValue(Result (1))."

                            5. In GetValue() which is *not* an implementation/object
                            dependent method:
                            "1. If Type(V) is not Reference, return V."

                            6. In section 5.2:
                            "When an algorithm is to produce a value as a result, the
                            directive 'return x' is used to indicate that the result
                            of the algorithm is the value of x and that the algorithm
                            should terminate."
                            ^^^^^^^^^
                            7. So [[Get]] (step 4 in GetValue()) should *not* be called
                            if the operand is not of type Reference (i.e. there is
                            no such method) if the implementation is an ECMAScript 3
                            conforming one.

                            But "typeof" triggers a script error *anyway* with certain
                            host objects in JScript and that is clearly a bug (i.e.
                            *non-conforming* behavior of the implementation) .

                            See?


                            PointedEars

                            Comment

                            • Thomas 'PointedEars' Lahn

                              #29
                              Re: JavaScript ECMAScript definitions

                              Richard Cornford wrote:
                              [color=blue]
                              > Thomas 'PointedEars' Lahn wrote:[color=green]
                              >> Lasse Reichstein Nielsen wrote:[/color]
                              > <snip>[color=green][color=darkred]
                              >>> You can not rely on *any* feature of a host object. It is valid
                              >>> ECMAScript to have a host object with *no* internal properties,
                              >>> including [[Get]]. It will fail in pretty much any expression you use
                              >>> it in, but it's a valid ECMAScript host object.[/color]
                              >>
                              >> No. If I test for properties with "typeof" and this property does not
                              >> exist, an ECMAScript compliant object/implementation would not trigger
                              >> a script error.[/color]
                              >
                              > When a typeof test generates an error while reading a property of a host
                              > object it seems unlikely that the property does not exist.[/color]

                              But yet such *tests* are highly likely since one seldom
                              knows the host environment the script code runs in.
                              [color=blue]
                              > I would conclude that a typeof test on a named property of a host object
                              > that generates an error (or crashes the browser) indicated that the
                              > property did refer to something, but that the something referred to was
                              > sufficiently unusual that attempting to use it caused problems.[/color]

                              IBTD. It is not up to the implementator to decide what accesses
                              by the programmer are likely and thus must be guarded and which
                              are not. An implementation needs to work, in all situations that
                              can be conceived, otherwise it is useless.
                              [color=blue]
                              > But Mozilla suffers from this pro0blem as much as IE does (and most over
                              > browsers); Try examining the properties of the global JavaClass and
                              > JavaPackage objects.[/color]

                              Alas, that's true, I have already had a hard time
                              to workaround that and I am still not done.


                              PointedEars

                              Comment

                              • Lasse Reichstein Nielsen

                                #30
                                Re: JavaScript ECMAScript definitions

                                Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:
                                [color=blue]
                                > 2. In section 8.7:
                                > "A Reference is a reference to a property of an object.
                                > A Reference consists of two components, the base object
                                > and the property name."
                                >
                                > 3. In section 11.4.3 (on how the "typeof" operation is evaluated):
                                > "1. Evaluate UnaryExpression .
                                > 2. If Type(Result(1)) is not Reference, go to step 4."
                                >
                                > That would apply to a property that does not exist.[/color]

                                No. A property access on an object to a property that doesn't exist
                                would *still* be a Reference, with a base object and a property
                                name. It's just that that base object doesn't have a property by that
                                name. The result is still a Reference.

                                The expression "foo.bar" (or the equivalent "foo['bar']"), where "foo"
                                refers to an object, and "bar" is not the name of a property of that
                                object, evaluates to a reference according to section 11.2.1.
                                In particular, it is the productions:
                                MemberExpressio n.identifier
                                MemberExpressio n[<identifier-string>Expressi on]
                                where Expression is <identifier-string>.

                                The evaluation of this is:
                                1. Evaluate MemberExpressio n.

                                Here MemeberExpressi on is a PrimaryExpressi on, which is an identifier.
                                The identifier is evaluated according to section 10.1.4. In this case
                                it gives a Reference to the object referenced by "foo".

                                2. Call GetValue(Result (1)).

                                Convert the Reference to a value. It is an object.

                                3. Evaluate Expression.

                                The expression "'bar'" is a literal and evaluates to the String 'bar'.

                                4. Call GetValue(Result (3)).

                                Just 'bar' again, since it is not a Refererence.

                                5. Call ToObject(Result (2)).

                                Result(2) is already an object, so just the same object again.

                                6. Call ToString(Result (4)).

                                Result(4) is already a string, so just the same string again.

                                7. Return a value of type Reference whose base object is Result(5) and
                                whose property name is Result(6).

                                That is, a Reference with base object being the object referenced
                                by the variable "foo", and property name "bar", even if there is
                                no property called "bar" on "foo"!

                                /L
                                --
                                Lasse Reichstein Nielsen - lrn@hotpop.com
                                DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                                'Faith without judgement merely degrades the spirit divine.'

                                Comment

                                Working...