<?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>23602</bug_id>
          
          <creation_ts>2013-10-23 06:39:25 +0000</creation_ts>
          <short_desc>&quot;optional any&quot; is nonsense that should be disallowed</short_desc>
          <delta_ts>2016-08-29 13:30: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>PC</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="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</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>95156</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-10-23 06:39:25 +0000</bug_when>
    <thetext>Or perhaps non-optional any is nonsense?

In any case, passing &quot;undefined&quot; to an &quot;any&quot; argument should presumably simply preserve the &quot;undefined&quot; value, and it looks like http://www.w3.org/TR/WebIDL/#es-any in fact specifies that.  Given that we no longer differentiate between &quot;undefined&quot; and &quot;omitted&quot;, what should passing &quot;undefined&quot; to an &quot;optional any&quot; do?  It seems weird to treat that as &quot;omitted&quot; when the &quot;any&quot; type can in fact represent the value.

I would argue that we should simply not have optional vs non-optional any: have only &quot;any&quot;, where it can always be not passed or explicitly passed as &quot;undefined&quot;, in which case it coerces the value to &quot;undefined&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95159</commentid>
    <comment_count>1</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2013-10-23 06:49:15 +0000</bug_when>
    <thetext>If we do that then we should do something similar for dictionary members, making

  dictionary A {
    any x;
  };

  interface B {
    void f(A a);
  };

  b.f({ x: undefined });

mean that x is present with the undefined value, rather than not present as is currently specced.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95160</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-10-23 06:53:08 +0000</bug_when>
    <thetext>Yes, I agree.

Basically, either we should remove &quot;undefined&quot; from the allowed value set of &quot;any&quot; (and then all &quot;any&quot; arguments should be optional and undefined becomed &quot;not present&quot;) or we should keep &quot;undefined&quot; in the value set and simply have &quot;undefined&quot; become the &quot;undefined&quot; value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95168</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-10-23 09:42:26 +0000</bug_when>
    <thetext>I think the latter solution of comment 2 makes the most sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127254</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-08-29 06:32:23 +0000</bug_when>
    <thetext>Did this got resolved? I think we made some changes to undefined handling since 2013-10.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127257</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2016-08-29 13:30:41 +0000</bug_when>
    <thetext>I don&apos;t think this got resolved, no.  I never got any feedback from other implementors on my proposal at https://lists.w3.org/Archives/Public/public-script-coord/2014JanMar/0176.html so I just went ahead and implemented a modified version of it in Gecko; see &lt;https://bugzilla.mozilla.org/show_bug.cgi?id=985536&gt;.  The difference between what I implemented and the proposal on the list is whether trailing non-optional &quot;any&quot; affects the argc check behavior....  But in the spec right now, as far as I can tell, &quot;optional any&quot; can only take on the state &quot;not passed&quot;, and can&apos;t have the state &quot;undefined&quot;.  That&apos;s what I aimed to fix in my Gecko changes; in Gecko the &quot;optional&quot; bit just affects .length and argc checks, but the value is always considered &quot;passed&quot; and may just have the value &quot;undefined&quot;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>