<?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>21295</bug_id>
          
          <creation_ts>2013-03-14 23:53:25 +0000</creation_ts>
          <short_desc>overload resolution: are DOMString and sequence&lt;T&gt; distinguishable now?</short_desc>
          <delta_ts>2013-08-04 09:10:30 +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>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>[v1]</status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Travis Leithead [MSFT]">travil</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>jsbell</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84453</commentid>
    <comment_count>0</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2013-03-14 23:53:25 +0000</bug_when>
    <thetext>In the Screen Orientation spec:
http://www.w3.org/TR/screen-orientation/#extensions-to-the-screen-interface

the interface specifies an overload between a sequence&lt;DOMString&gt; and a DOMString:

  boolean lockOrientation (DOMString orientation);
  boolean lockOrientation (sequence&lt;DOMString&gt; orientations);

So, when an implementation gets a DOMString as a parameter, I wondered how I could tell whether I should apply the sequence&lt;&gt; conversion logic, or take the DOMString as-is? 

The sequence&lt;T&gt; conversion logic would seem to take a DOMString &quot;Hi&quot;, and per section 4.2.24:
http://dev.w3.org/2006/webapi/WebIDL/#es-sequence

I&apos;d fall through to the &quot;Any kind of object except for a native Date object or a native RegExp object&quot; rule.

DOMString&apos;s have a length (2 in this case), so I&apos;d end up either taking the DOMString as is (one viable outcome) or converting the DOMString into [&quot;H&quot;, &quot;i&quot;] per 4.2.24 (equally valid outcome). 

I think that means that these two types are not distinguishable anymore? Somehow I don&apos;t think that&apos;s the intent...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84455</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-03-15 01:13:40 +0000</bug_when>
    <thetext>DOMString and sequence are distinguishable, yes.

As for how you decide which overload is being called, that&apos;s described at http://dev.w3.org/2006/webapi/WebIDL/#dfn-overload-resolution-algorithm

In this case, step 13 is reached with i == 0.  The substeps of step 13 are followed, you skip step 7 because V is not an object, and then step 8 treats it as a DOMString.

That&apos;s assuming what&apos;s passed in is a primitive string.  If a JS String object is passed in, it will in fact be treated as a sequence the way the spec is currently written, as far as I can tell.  That might be worth fixing....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90585</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-07-10 13:53:45 +0000</bug_when>
    <thetext>Note that &quot;DOMString, DOMString...&quot; or maybe just &quot;DOMString...&quot; would be preferable signature.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91614</commentid>
    <comment_count>3</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2013-08-04 09:10:30 +0000</bug_when>
    <thetext>As Boris says, these are distinguishable now, and the rules in #dfn-overload-resolution-algorithm should work.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>