<?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>22858</bug_id>
          
          <creation_ts>2013-08-02 05:43:39 +0000</creation_ts>
          <short_desc>use @@hasInstance instead of [[HasInstance]]</short_desc>
          <delta_ts>2016-09-08 20:54:03 +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>RESOLVED</bug_status>
          <resolution>MOVED</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="Cameron McCormack">cam</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>allen</cc>
    
    <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>d</cc>
    
    <cc>erik.arvidsson</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>91535</commentid>
    <comment_count>0</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2013-08-02 05:43:39 +0000</bug_when>
    <thetext>In ES6, there is a @@hasInstance symbol that is used to define &quot;instanceof&quot; behaviour.  We should use that rather than defining [[HasInstance]], since it has gone from the spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117586</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-29 17:58:32 +0000</bug_when>
    <thetext>What bug resulted in us adding an [[HasInstance]] override?

I think having this is a bad idea and is future hostile. It makes it harder to move objects from the web platform into JavaScript as they will end up having subtly different behavior. (Or JavaScript&apos;s default library will end up being subtly inconsistent.)

If we want better identity checks we should just introduce a method that can do it and not mess with default class semantics.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117587</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-01-29 18:06:37 +0000</bug_when>
    <thetext>Note that there was a bunch of discussion about this on the mailing list.  The idea of an isArray method or the like, whether per-interface or more generic, was strongly opposed by various people, including some TC39 folks...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117588</commentid>
    <comment_count>3</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-01-29 18:11:12 +0000</bug_when>
    <thetext>While I agree that the override of [[HasInstance]] seems pretty pointless, I don&apos;t understand why it would be future-hostile. JS versions of the classes could just override their @@hasInstance, e.g.

```js
class WebIDLThingy {
  static [Symbol.hasInstance](x) {
    return performBrandCheck(x);
  }
}
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117589</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-29 18:15:59 +0000</bug_when>
    <thetext>That did not happen for e.g. ArrayBuffer. Another example would be promises, which in Gecko are implemented in terms of IDL and therefore have this &quot;feature&quot;.

bz, did we consider something like

  Window.ignoreGlobalInstanceOf(..., ...)

as that seems hardly different from what this magic @@hasInstance override is?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117595</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-01-29 19:26:08 +0000</bug_when>
    <thetext>&gt;  Window.ignoreGlobalInstanceOf(..., ...)

Not with that name, but I think we did... I&apos;d have to check the archives.

Anyway, I&apos;m maybe ok with people wanting to reopen this discussion if we can finally pick something, get UAs to converge on it, and stick to it.  Though I will say that a fair amount of Firefox extension code has been written with the current Web IDL definition in mind, because _last_ time we had this conversation people were told we had finally decided something.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127345</commentid>
    <comment_count>6</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-09-08 20:54:03 +0000</bug_when>
    <thetext>https://github.com/heycam/webidl/issues/129</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>