Adios' Notes

« Back to posts
  • Viewed
    times

Filed under

  • javascript
  • programming
  • reflection
November 3, 2009

Reflection (computer science) - Wikipedia, the free encyclopedia

  • Edit
  • Delete
  • Tags
  • Autopost

ECMAScript

Here is an equivalent example in ECMAScript, and therefore works in JavaScript and ActionScript:

// Without reflection
new Foo().hello()
 
// With reflection
 
// assuming that Foo resides in this
new this['Foo']()['hello']()
 
// or without assumption
new (eval('Foo'))()['hello']()

[edit]

via en.wikipedia.org

Tweet
  • 0 responses
  • Like
  • Comment