Re: Extended attributes on WebIDL typedefs need to be defined better, or just dropped

On Sat, Sep 1, 2012 at 5:15 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> All the WebIDL spec says right now about these is:
>
>   Extended attributes can be given directly after the typedef keyword,
>   and any such extended attributes will be taken to apply to constructs
>   that use the typedef.
>
> What does "constructs that use the typedef" mean?
>
> If I have:
>
>   typedef [Foo] Bar Baz;
>   readonly attribute Baz something;
>
> Is the [Foo] applied to the "something" or to the attribute?  Consider
> that, for example, [TreatNullAs] is an annotation on an attribute, and
> applies to the attribute, not an annotation on the type.
>
> Honestly, I'm not sure I see what the use cases are for extended
> attributes here.  I propose that we just drop them.


Mmm

I've been using ExtAttrs on typedefs for documentation purposes in the
CSSOM spec, e.g.,

typedef
[Documentation=
 "<p>The {@name} sequence represents an ordered collection of CSS style
rules.</p>"
]
sequence<CSSRule> CSSRuleList;

However, given

Extended attributes<http://dev.w3.org/2006/webapi/WebIDL/#dfn-extended-attribute>
can
be given directly after the typedef keyword, and any such extended
attributes will be taken to apply to constructs that use the typedef.

I see the problem you question. I had naively presumed that typedef did in
fact define a type (golly its name is 'typedef'). Maybe the fix is to
really define a type and not treat as mere shorthand?

Received on Friday, 31 August 2012 23:58:53 UTC