title: Having trouble making Object.defineProperty set work in a loop
body: <p>I need to set some dynamic setters and would like to use defineProperty.</p>
  
  <p>However I can't figure out why this is not working. Note that someone writes in <a href="https://stackoverflow.com/questions/13787643/object-defineproperty-get-set-closure">this other question</a> that they got it working, but their examples don't work for me either...</p>
  
  <pre><code>var a = { q:1, b:2, c:3, d:4, e:5, f:9 }
  
  var iFaces = [ {}, {}, {}, {} ]
  
  for( key in a )
  {
      console.log( key );
  
      for( var l = iFaces.length - 1; l &gt;= 0; --l )
      {
          (function( that, name )
          {
              Object.defineProperty
              (
                     that
                  ,  name
  
                  ,  {
                            enumerable  : true
                          , configurable: true
                          , set         : function( value ){ that[ name ] = value }
  
                      }
              )
          }
          )( iFaces[ l ], key )
  
          iFaces[ l ][ key ] = a[ key ]
      }
  }
  
  // output: RangeError: Maximum call stack size exceeded
  </code></pre>
  
  <p>It must be recursing somehow. </p>
  
  <p><strong>edit</strong>: The feature that I try to implement is 2 objects that keep there properties in sync. So I wanted to create a generic setter which updates the sister object if that hasn't got the same reference/value.</p>
  
  <p>I need the solution to be ES5 standard compliant, and it seems most alternative setters/getters are implementation dependent hacks.</p>