<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>28236</bug_id>
          
          <creation_ts>2009-08-12 15:47:31 -0700</creation_ts>
          <short_desc>Eval doesn&apos;t respect JavaScript&apos;s const keyword</short_desc>
          <delta_ts>2012-03-07 00:32:49 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>31813</dup_id>
          
          <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="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aroben</cc>
    
    <cc>barraclough</cc>
    
    <cc>kmccullough</cc>
    
    <cc>oliver</cc>
    
    <cc>timothy</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>139615</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2009-08-12 15:47:31 -0700</bug_when>
    <thetext>It seems a const variable declared in the Console is just a &quot;var&quot; and can change value.

    &gt; zzz // ensure it doesn&apos;t exist
    ReferenceError: Can&apos;t find variable: zzz
    
    &gt; const zzz = 10;
    undefined
    
    &gt; zzz = 5; // should do nothing
    5
    
    &gt; zzz
    5

I would have expected the result to have been 10, since the constant shouldn&apos;t change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139620</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2009-08-12 15:54:30 -0700</bug_when>
    <thetext>Maybe this is actually a problem with eval():

Expected Behavior without eval:

    javascript:const zza = 10; zza = 5; alert(zza) =&gt; 10

Bad Behavior with eval:

    javascript:alert(eval(&quot;const zzb = 10; zzb = 5; zzb&quot;)) =&gt; 5

How should this bug be reclassified?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139672</commentid>
    <comment_count>2</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2009-08-12 17:18:14 -0700</bug_when>
    <thetext>Oliver, thoughts?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139673</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-08-12 17:20:49 -0700</bug_when>
    <thetext>Yeah this is a known bug with eval</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>572646</commentid>
    <comment_count>4</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-03-07 00:32:49 -0800</bug_when>
    <thetext>We should resolved this by implementing ES Harmony block scoped const.

*** This bug has been marked as a duplicate of bug 31813 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>