<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27048</bug_id>
          
          <creation_ts>2014-10-14 15:51:04 +0000</creation_ts>
          <short_desc>Allow partial enums</short_desc>
          <delta_ts>2016-10-11 20:51:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>WebIDL</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mounir Lamouri">mounir</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>d</cc>
    
    <cc>harald</cc>
    
    <cc>josh</cc>
    
    <cc>jyasskin</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
    
    <cc>tobie.langel</cc>
    
    <cc>w3c</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>113114</commentid>
    <comment_count>0</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2014-10-14 15:51:04 +0000</bug_when>
    <thetext>It would be interesting to have partial enums in order to enforce an allowed list of keywords passed as parameters but still allow other specification to extend that list without having to make the parameter an DOMString.

A concrete use case would be the Permissions API that would define a PermissionName enum that could be extended by specifications defining new permissions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113115</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-14 15:56:45 +0000</bug_when>
    <thetext>That is not an ideal way of writing specifications. With all the bits fragmented. We have some of that already today and it is rather painful for implementers. What is wrong with reviving the base specification?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114619</commentid>
    <comment_count>2</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2014-11-06 21:28:54 +0000</bug_when>
    <thetext>We are actually considering using an enum in the specification now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124841</commentid>
    <comment_count>3</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2016-02-04 16:22:08 +0000</bug_when>
    <thetext>So this issue was brought up again today as I&apos;m moving forward with the Generic Sensor API.

Here&apos;s the concrete use case:

The editor writes a spec for the Heartbeat Sensor. Said spec obviously requires permissioning. Currently this requires amending the Permissions API to add a corresponding string (e.g. &quot;heartbeat-sensor&quot;) to the PermissionName Enum[1].

Now, what happens when an implementor decides to implement the Permissions API, but not the Heartbeat sensor? Will he filter the corresponding string out of the enum?

If an implementor decides to implement the Heartbeat Sensor API, then removes it because it turns out the privacy concerns are to big, aren&apos;t the risks of forgetting to modify the enum higher if it lies in the Permissions API? In that case, developers could potentially have the Permission&apos;s API tell them the user has granted access to a sensor that&apos;s no longer implemented. Seems strange.

None of these are an issue if the &quot;heartbeat-sensor&quot; string is added to the PermissionName Enum[1] from the Heartbeat Sensor spec itself. I&apos;m also not sure there are any downsides to having a split enum in this concrete example. Quite the contrary, actually, as it seems much more logical to split cross-cutting concerns like these across specs.

(Note I&apos;m not suggesting that partial enums are the right choices in all use cases, but it&apos;s not because a hammer isn&apos;t the appropriate tool to fix a pair of glasses that a carpenter shouldn&apos;t be able to use one.)

[1]: https://w3c.github.io/permissions/#idl-def-PermissionName</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127743</commentid>
    <comment_count>4</comment_count>
    <who name="Harald Alvestrand">harald</who>
    <bug_when>2016-10-11 20:48:27 +0000</bug_when>
    <thetext>This bug has been open for 2 years. Can we either get it added to the spec or definitely rejected as a bad idea, so that people won&apos;t have hope that it will be added?

(I have need for this type of functionality in making valid IDL for the relationshiop between https://w3c.github.io/webrtc-stats/webrtc-stats.html and https://w3c.github.io/webrtc-pc/webrtc.html. If we can&apos;t have extensible enums, I&apos;m going to suggest that we use a DOMString instead.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127744</commentid>
    <comment_count>5</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-10-11 20:51:41 +0000</bug_when>
    <thetext>As with many specs, Web IDL has overtaxed editors and a large backlog of bugs, several of which are more urgent than this one. If this is truly important to you, a pull request to add the feature to Web IDL would be excellent, as for example Jeffrey has recently done to close out the long-standing &quot;open ended dictionary&quot; feature.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>