<?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>14916</bug_id>
          
          <creation_ts>2011-11-23 18:53:57 +0000</creation_ts>
          <short_desc>WebIDL has no function type</short_desc>
          <delta_ts>2011-12-28 16:34:21 +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>CLOSED</bug_status>
          <resolution>WONTFIX</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="Aryeh Gregor">ayg</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>ian</cc>
    
    <cc>kennyluck</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>60395</commentid>
    <comment_count>0</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-11-23 18:53:57 +0000</bug_when>
    <thetext>HTML has tons of IDL attributes like

  [TreatNonCallableAsNull] attribute Function? onabort;

Function is actually an interface it defines:

  http://www.whatwg.org/specs/web-apps/current-work/#function

This is very weird, and probably contradicts ES in some details (like whether the .call property of the prototype is configurable).  It would make more sense for WebIDL to have a dedicated function type.  The algorithm for converting to a function should probably return null if the thing passed in isn&apos;t callable, so the above could become just

  attribute function? onabort;

since every single usage of Function? in HTML seems to use [TreatNonCallableAsNull], so it may as well just be the behavior all the time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60396</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-23 19:04:32 +0000</bug_when>
    <thetext>This may also be the last remaining use of [Callback=FunctionOnly], so providing a dedicated interface for this would let us kill both FunctionOnly and TreatNonCallableAsNull.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60397</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-23 19:07:29 +0000</bug_when>
    <thetext>(Note though that this wouldn&apos;t let people create event handlers without referencing HTML, as some people would like; see http://www.w3.org/mid/op.v5atfs1x64w2qv@annevk-macbookpro.local )</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62087</commentid>
    <comment_count>3</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-12-28 06:19:18 +0000</bug_when>
    <thetext>We now have callbacks in Web IDL, so HTML&apos;s Function can be defined as:

  callback Function = any (any... arguments);

This is less weird.  I don&apos;t think we really need to move it across to Web IDL; the weirdness of the Timer APIs is not something I think we want to propagate to new APIs.

Aryeh, let me know if not adding this definition to Web IDL itself is acceptable, thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62103</commentid>
    <comment_count>4</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-12-28 16:34:21 +0000</bug_when>
    <thetext>That seems okay to me.  I don&apos;t think we need a special &quot;function&quot; type, because in fact most of the users of Function in HTML should get a callback with a specific signature, not just any old function.

(It seems to make no actual difference what the signature for the callback is, except that it theoretically guarantees the type of the parameters and puts some constraints on how some return values will behave.  But it&apos;s still handy as documentation.)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>