do any host object implementations define [[DefaultValue]]??

Allen Wirfs-Brock Allen at Wirfs-Brock.com
Wed Feb 9 13:20:13 PST 2011


The ES5 spec. defines [[DefaultValue]] as an internal method but all objects defined by the specification use the default implementation specified in 8.12.8.

Presumably the only reason this algorithm needs to be an "internal method" rather than an "abstract operation" is to allow the possibility that some host objects have different definitions of it.  Does this actually occur in browser implementations?

[[DefaultValue]] itself is only directly called from ToPrimitive (9.1).  [[DefaultValue]]'s implementation essentially reduces to calls to either or both of the toString and valueOf methods of its this object.  If any browser host objects implementation do have unique  [[DefaultValue]] implementations do they do anything other than the equivalent of calling their toString or valueOf methods?

You can probably guess whats behind these questions?  Is [[DefaultValue]] really an essential part of the ECMAScript internal meta-object protocol?

Allen


More information about the es-discuss mailing list