[Bug 23623] Support [Clamp] for sequences

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

Anne annevk@annevk.nl changed:

       What    |Removed                     |Added

             CC|                            |annevk@annevk.nl

--- Comment #1 from Anne annevk@annevk.nl ---

If you do not mean sequence<[Clamp] unsigned long>, could you please elaborate

on what you are proposing here?

Contact us to advertise here
# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

--- Comment #2 from mvanouwerkerk@chromium.org --- Hi Anne, not sure whether the syntax is the one I posted or the one you posted. But the idea is to clamp the values in the sequence.

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

Anne annevk@annevk.nl changed:

       What    |Removed                     |Added

         Status|NEW                         |RESOLVED
     Resolution|---                         |WORKSFORME

--- Comment #3 from Anne annevk@annevk.nl ---

Right, that should already work with the syntax I posted.

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

Cameron McCormack cam@mcc.id.au changed:

       What    |Removed                     |Added

         Status|RESOLVED                    |REOPENED
     Resolution|WORKSFORME                  |---

--- Comment #4 from Cameron McCormack cam@mcc.id.au ---

The spec doesn't allow that currently though, right? [Clamp] goes on things like attributes, operation argument, etc.

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

--- Comment #5 from Anne annevk@annevk.nl ---

Oh really? I guess it's only allowed at a syntax level then. Seems like that always ought to work though. E.g. if we have "[Test] DOMString" it should work regardless of context.

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

Nils Barth nbarth+w3bugzilla@google.com changed:

       What    |Removed                     |Added

             CC|                            |nbarth+w3bugzilla@google.co
               |                            |m

--- Comment #6 from Nils Barth nbarth+w3bugzilla@google.com ---

Anne, it's tempting to attach extended attributes to types, but the grammar (and semantics) are significantly easier if we attach to operation arguments (and members) instead. Syntactically: [ExtAttr] sequence<long> foo ...instead of: sequence<[ExtAttr] long> foo

This is b/c extended attributes appear at 3 levels:

  • definitions (interfaces etc.),
  • members (attributes, operations, etc.),
  • arguments (to operations).

Extended attributes basically don't attach to types; if they did, we'd need to handle nesting, so these would have different meanings: [ExtAttr] sequence<long> foo

sequence<[ExtAttr] long> foo ...and there would be ambiguity of whether an ExtAttr applies to a type or an argument (or an attribute etc.); this: [ExtAttr] sequence<long> foo

parses 2 ways: ([ExtAttr] sequence<long>) foo [ExtAttr] (sequence<long> foo) ...which is pretty ugly.

dev.w3.org/2006/webapi/WebIDL/#idl-extended-attributes

Note that in the Candidate Recommendation, extended attributes are applicable to typedefs: typedef [Clamp] octet Value; www.w3.org/TR/WebIDL/#dfn-typedef ...so: sequence<Value>

in principle expands to: sequence<[Clamp] octet> ...but this makes quite a mess (as above), and is not present in the Editor's Draft: dev.w3.org/2006/webapi/WebIDL/#dfn-typedef

Hope this helps!

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

Boris Zbarsky bzbarsky@mit.edu changed:

       What    |Removed                     |Added

             CC|                            |bzbarsky@mit.edu

--- Comment #7 from Boris Zbarsky bzbarsky@mit.edu ---

So this is specifically talking about [Clamp] applied to a sequence<T> where T

is a type that [Clamp] can currently be applied to, right?

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

--- Comment #8 from Nils Barth nbarth+w3bugzilla@google.com --- (In reply to Boris Zbarsky from comment #7)

So this is specifically talking about [Clamp] applied to a sequence<T> where T is a type that [Clamp] can currently be applied to, right?

Yes, exactly: we want |[Clamp] sequence<T>| to mean "clamp all terms of

sequence".

# bugzilla at jessica.w3.org (4 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

--- Comment #9 from mvanouwerkerk@chromium.org --- This bug is one of the last dependencies for finalizing the Vibration API. Do you have an estimate for when it might be fixed? Is there anything I could help with? I'm not sure how much work it is, or how much time the Web IDL folks have available for looking at this.

# bugzilla at jessica.w3.org (2 months ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=23623

Tobie Langel tobie.langel@gmail.com changed:

       What    |Removed                     |Added

         Status|REOPENED                    |RESOLVED
             CC|                            |tobie.langel@gmail.com
     Resolution|---                         |FIXED

--- Comment #10 from Tobie Langel tobie.langel@gmail.com ---

Fixed by heycam/webidl/commit/faaaaa9ffb548a303db362a09e4b1504c4605e0c

Want more features?

Request early access to our private beta of readable email premium.