Adios’ Notes

Adios’ Notes

Adios Tsai  //  

Nov 3 / 10:32am

Reflection (computer science) - Wikipedia, the free encyclopedia

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]

Loading mentions Retweet
Filed under  //  javascript   programming   reflection  

Comments (0)

Nov 3 / 10:31am

Reflection (computer science) - Wikipedia, the free encyclopedia

Common Lisp

Here is an equivalent example in Common Lisp:

;;Without reflection
(hello)
 
;;With reflection
(funcall (find-symbol "HELLO"))

[edit]

Compiled Language using symbol table.

Loading mentions Retweet
Filed under  //  lisp   programming   reflection  

Comments (0)