[Harmony Proxies] Proposal: Property fixing

Cameron McCormack cam at mcc.id.au
Thu Jun 16 21:06:23 PDT 2011

Mark S. Miller:
> Why does each array host object have its own toString method rather than
> using one inherited from Array.prototype? ES5 already says that
> Array.prototype.toString is "intentionally generic; it does not require that
> its *this* value be an Array object." So that should work fine.

Good question!  I’m not sure why I have that.  It’s also gratuitously
different from Array.prototype.string (nulls and undefineds would get
stringified to "null"s and "undefined"s with my version).

> Unfortunately, that same paragraph does go on to say that "Whether
> the toString function can be applied successfully to a host object
> is implementation-dependent." If this clause actually prevents using
> Array.prototype.toString here, which would be a shame, the how about
> having array host object inherit a common toString method from the
> array host object prototype object?

Having it on the array host host object prototype object would be better
than as an own property on the array host object itself, you are right.
But let’s just assume that the inheriting Array.prototype.toString just
works (i.e., let’s have Web IDL require that it works). :)

Cameron McCormack ≝ http://mcc.id.au/

More information about the es-discuss mailing list