While making an editing pass over the ES3.1 draft spec, I came across
the following oddness inherited from the ES3 spec:

8.6.2.2 [[Put]] (P, V)
             When the [[Put]] method of O is called with property P
and value V, the following steps are taken:
             1. Call the [[CanPut]] method of O with name P.
             2. If Result(1) is false, return.
             ....

8.6.2.3 [[CanPut]] (P)
             The [[CanPut]] method is used only by the [[Put]] method.
             When the [[CanPut]] method of O is called with property
P, the following steps are taken:
             1. If O doesn't have a property with name P, go to step 4.
             2. If the property has the ReadOnly attribute, return false.
             3. Return true.
             4. If the [[Prototype]] of O is null, return true.
             5. Call the [[CanPut]] method of [[Prototype]] of O with
property name P.
             6. Return Result(5).

As I read this spec, if object B inherits from object A, A has a
ReadOnly 'foo' property, and B does not have its own 'foo' property,
then this spec says that

    B.foo = ...

should fail rather than define an own 'foo' property on B. This seems
to imply that ReadOnly implies non-overrideable. (Curiously, Java used
the keyword "final" for both concepts, but that's just a coincidence.
In Java, it means one or the other depending on whether it applies to
a field or a method.)

Is this intended or a mistake? Do JavaScript implementations obey this
peculiar behavior? Do programs depend on it?

-- 
    Cheers,
    --MarkM
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to