Re: [heycam/webidl] Allow extended attributes to apply to types (#286)

bzbarsky commented on this pull request.



> @@ -5145,6 +5123,16 @@ is a string, not necessarily unique, that identifies the type.
 Each sub-section below defines what the type name is for each
 type.
 
+Additional types can be created from existing ones by specifying certain
+[=extended attributes=] on the existing types. For example,
+<code>[Clamp] long</code> defines a new type whose behavior is based on
+that of the {{long}} type, but modified as specified by the [{{Clamp}}]
+extended attribute.
+
+The [=type name=] of a type annotated with an [=extended attribute=] is
+the concatenation of the type name of the annotated type and a string
+corresponding to the extended attribute's identifier.
+

Fwiw, Gecko uses type names to auto-generate union types and their accessors.  So for every type in the union, there is an IsFoo() accessor on the union, where Foo is the type name.

It ends up being pretty ugly in practice.  ;)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/286

Received on Friday, 3 February 2017 23:31:06 UTC