W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] WebIDL nested interfaces

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 10 Sep 2012 17:52:48 -0500
Message-ID: <CABirCh8HWk8CMPsKy2OuKdsqp633jyFi9Z5vCEhOScpr+qSPGA@mail.gmail.com>
To: Tobie Langel <tobie.langel@gmail.com>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>, Cameron McCormack <cam@mcc.id.au>, Dean Jackson <dino@apple.com>, Ashley Gullen <ashley@scirra.com>
On Mon, Sep 10, 2012 at 5:39 PM, Tobie Langel <tobie.langel@gmail.com>wrote:

> > It's too late; WebGL is a shipping, widely-used API.  (This isn't a WebGL
> > problem, either; it's just doing what every other API on the platform
> does.
> >  I don't think WebIDL even has a mechanism to put interfaces inside other
> > objects.)
>
> Really? Wouldn't this do the trick:
>
> interface WebGLActiveInfo {
>     readonly attribute GLint size;
>     readonly attribute GLenum type;
>     readonly attribute DOMString name;
> };
>
> interface WebGLGlobal {
>   attribute WebGLActiveInfo activeInfo;
> };
>
> partial interface Window {
>   attribute WebGLGlobal WebGL;
> };
>

This is just creating a global object "WebGL" containing an object using
the WebGLActiveInfo interface.  It's not moving the WebGLActiveInfo
interface itself into an object.  It sounds like you want something like

interface WebGL {
    interface WebGLActiveInfo {
        ...
    }
}

interface WebGLRenderingContext {
    WebGL.WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint
index);
}

-- 
Glenn Maynard
Received on Monday, 10 September 2012 22:53:18 UTC

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