W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2009

[whatwg] Expandos and Prototyping

From: Charles Pritchard <chuck@jumis.com>
Date: Mon, 11 May 2009 18:05:35 -0700
Message-ID: <4A08CB5F.1040709@jumis.com>
Are expando / prototype functions at all included in the HTML 5 specs?
While we may all know what Object.prototype does, I'd like to see its 
use added to
Section 6: Web browsers.

The Prototype Expando is not necessarily a Javascript-only construct, 
and neither is HTML 5.

While I'm not championing full prototype inheritance, I do wonder 
whether some small section of HTML 5 might be describe the most basic of 
prototyping and expandos:

Many projects use "ellipse" or other shapes for example, but this is easier:
CanvasRenderingContext2D.prototype.funcName = function() {
.... document.createElement('canvas').getContext('2d').funcName();

I've never seen any developers attempt to use multiple inheritance 
within the CanvasRenderingContext2D object,
nor have I tested myself to see if Firefox (the champion of such 
schemes) supports it. Which is why I'd be
more than satisfied simply requiring single inheritance. It's already 
available in all implementations,
and we spent a good deal of time making it available in our own.

Expando Prototype would need descriptions of:
expandos, prototyped objects, for(... in ...)

All modern browsers support prototype, and so do many languages (without 
writing libraries).
We've confirmed that it expandos and prototypes work just fine in Active 
X, MS long ago created IDispatchEx.

Any host language with getter / setter availability can implement 
prototyping and expandos on an object, at least of one depth.

I'd like to see  ".prototype" described in the scripting section.

That said, I'm more hesitant to champion ".constructor" and ".__proto__".

Received on Monday, 11 May 2009 18:05:35 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:12 UTC