User Tools

Site Tools


at:tutorial:reflection

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
at:tutorial:reflection [2010/11/16 15:59]
tvcutsem fixed
at:tutorial:reflection [2010/11/16 16:32] (current)
tvcutsem
Line 4: Line 4:
  
 The reflective model of AmbientTalk is based on [[http://bracha.org/mirrors.pdf|mirrors]], meta-level objects which allow one to reflect on an object's state and behaviour. How to create such mirrors and how they can be used is demonstrated in the first part of the tutorial. The second part of the tutorial showcases how to construct mirages, objects which override the default meta-level operations with custom behaviour. This tutorial concludes with a brief overview of the meta-level operations which are offered by AmbientTalk mirrors. The reflective model of AmbientTalk is based on [[http://bracha.org/mirrors.pdf|mirrors]], meta-level objects which allow one to reflect on an object's state and behaviour. How to create such mirrors and how they can be used is demonstrated in the first part of the tutorial. The second part of the tutorial showcases how to construct mirages, objects which override the default meta-level operations with custom behaviour. This tutorial concludes with a brief overview of the meta-level operations which are offered by AmbientTalk mirrors.
 +
  
 ===== Mirrors ===== ===== Mirrors =====
Line 45: Line 46:
 > def x :=mirrorOnP.grabSlot(`x) > def x :=mirrorOnP.grabSlot(`x)
 >> <accessor method for:x> >> <accessor method for:x>
-> x() 
->> 2 
 // and we can also invoke methods reflectively: // and we can also invoke methods reflectively:
 > mirrorOnP.invoke(p, lobby.at.lang.values.createInvocation(`distanceToOrigin,[],[])); > mirrorOnP.invoke(p, lobby.at.lang.values.createInvocation(`distanceToOrigin,[],[]));
at/tutorial/reflection.txt ยท Last modified: 2010/11/16 16:32 by tvcutsem