On Aug 6, 2008, at 7:17 AM, Thomas Broyer wrote:
On Wed, Aug 6, 2008 at 11:29 AM, Maciej Stachowiak wrote:
I think Garret has a valid point (despite his needlessly rude tone)
that the
way we describe magical dynamic properties in a way that makes
clear they
are also visible to the "in" operator and to
Object.prototype.hasOwnProperty. Are there any DOM bindings that
have index
(or named) properties which are *not* visible in such a way?
You mean "ECMAScript binding implementation", right?
Using reflection on a C# class won't give you a property named "0" or
"myform", even though you can get them using myvariable[0] and
myvariable["myform"].
If I were to implement a binding in Python, I would do the same
(though « 0 in myvariable » and « "myform" in myvariable » would work
the same as in ECMAScript today; but dir(myvariable) wouldn't show "0"
or "myform")
If not, then the current [IndexGetter] definition is useless and we
need
a better formalism.
...or rather the ECMAScript binding should define this particularity.
I think Web IDL should provide a formalism to cater to this,
because nearly
all bindings with special dynamic properties work like this afaik.
But I
think it would have to involve a pseudo-method for the
"hasOwnProperty"
check (which "in" is based on).
hasOwnProperty is ECMAScript-specific.
The Web IDL includes specific requirements for how to map an interface
specified in Web IDL to ECMAScript. So, indeed, that would be the part
of the Web IDL spec that would be the best place to define this.
Regards,
Maciej