<?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>12445</bug_id>
          
          <creation_ts>2011-04-07 23:59:18 +0000</creation_ts>
          <short_desc>Consider making properties corresponding to IDL constants be configurable and unwritable</short_desc>
          <delta_ts>2011-05-08 23:37:22 +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>RESOLVED</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="Cameron McCormack">cam</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>allen</cc>
    
    <cc>brendan</cc>
    
    <cc>erights</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
    
    <cc>travil</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>47245</commentid>
    <comment_count>0</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-04-07 23:59:18 +0000</bug_when>
    <thetext>We should maybe make properties corresponding to IDL constants be configurable, unwritable data properties, for consistency with the configurability of those for operations and attributes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47270</commentid>
    <comment_count>1</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2011-04-08 15:02:22 +0000</bug_when>
    <thetext>This may be the right attribute combination based on what browsers implement as well, but it is not the high-integrity approach. Cc&apos;ing some tc39ers.


/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47274</commentid>
    <comment_count>2</comment_count>
    <who name="Mark S. Miller">erights</who>
    <bug_when>2011-04-08 17:23:19 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; This may be the right attribute combination based on what browsers implement as
&gt; well, but it is not the high-integrity approach. Cc&apos;ing some tc39ers.

As long as an initialization script can freeze these properties before other code runs, there&apos;s no fatal problem here. But this seems weird for a concept labeled &quot;constant&quot;, and it makes the obvious optimizations harder to implement.

Since WebIDL does have a distinct notion of &quot;constant&quot;, and since the ConstExpr used to initialize the constant http://dev.w3.org/2006/webapi/WebIDL/#prod-ConstExpr is not something that an initialization script might plausibly want to alter, it would seem that the normal reasons for making properties initially configurable do not apply. Why not make declared constants non-writable, non-configurable data properties?

Another precedent to look at is, for example, Math.E, which is a non-writable, non-configurable data property, as are the other Math constants. (And yes, I am aware that these are speced by EcmaScript rather than WebIDL.)



&gt; 
&gt; /be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47276</commentid>
    <comment_count>3</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-04-08 18:04:57 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Since WebIDL does have a distinct notion of &quot;constant&quot;, and since the ConstExpr
&gt; used to initialize the constant
&gt; http://dev.w3.org/2006/webapi/WebIDL/#prod-ConstExpr is not something that an
&gt; initialization script might plausibly want to alter, it would seem that the
&gt; normal reasons for making properties initially configurable do not apply.

What are the normal reasons, secure JS subsets?  I&apos;ve been considering the use case of scripts wanting to add hooks into existing DOM APIs, for example as a completely synthetic use case, maybe you want to count how many times a particular property for a constant is looked up.

&gt; Why not make declared constants non-writable, non-configurable data properties?

That&apos;s how they&apos;re currently defined.

&gt; Another precedent to look at is, for example, Math.E, which is a non-writable,
&gt; non-configurable data property, as are the other Math constants. (And yes, I am
&gt; aware that these are speced by EcmaScript rather than WebIDL.)

That&apos;s definitely a reasonable precedent to consider.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47732</commentid>
    <comment_count>4</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2011-04-27 06:17:54 +0000</bug_when>
    <thetext>FWIW:

We had a similar discussion in IE when deciding what attributes to give &quot;const&quot; properties. During Beta, we had the properties as configurable, but later changed our minds and made them fully &quot;const&quot; to emphasize the meaning of the term. 

So now, in IE9 RTM, we have:

&gt;&gt; Object.getOwnPropertyDescriptor(Node, &quot;ELEMENT_NODE&quot;) 
{
	value : 1,
	writable : false,
	enumerable : true,
	configurable : false
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48336</commentid>
    <comment_count>5</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-05-08 23:09:29 +0000</bug_when>
    <thetext>OK, I will leave them non-configurable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48337</commentid>
    <comment_count>6</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-05-08 23:37:22 +0000</bug_when>
    <thetext>Adjusting resolution as the decision was to not make a change. (which I&apos;m fine with for what it&apos;s worth).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>