W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

Re: [WebIDL] add text to discourage `[Optional] Interface / [NoInterfaceObject] interface Interface` and encourage `dictionary Dictionary` instead

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Tue, 30 Aug 2011 08:50:37 -0700
Cc: public-script-coord@w3.org
Message-Id: <91C75A62-3FE8-4C12-9CDA-DFE73E73AA0E@wirfs-brock.com>
To: timeless <timeless@gmail.com>

On Aug 29, 2011, at 10:06 AM, timeless wrote:

> I recently saw a snippet of Web IDL code that goes like this:
>  function A(Foo foo, [Optional] Bar bar);
>  [NoInterfaceObject] interface Bar
>    { ... };
> In response to this, I'd like Web IDL to include some text to the effect of:
>    You SHOULD use `dictionary Foo` instead of `[NoInterfaceObject]
> interface Foo` if Foo is intended for use as an argument, especially
> an [Optional] argument.

That sounds like it would discourage patterns like this:

interface SomeOpaqueType {};

interface SomeResourceManager {
     SomeOpaqueType getSomeResource(...);
     void operateUsingResource(in SomeOpaqueType);

I don't see why you would want to discourage this as it is a  well understood design pattern.  For example see, http://web.cecs.pdx.edu/~antoy/flp/patterns/#Opaque%20Type 

Using dictionary to pass optional arguments is a complete different use case.


Received on Tuesday, 30 August 2011 15:51:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:04 UTC