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 revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
at:tutorial:reflection [2007/06/29 11:26] – * stijnmat:tutorial:reflection [2007/07/13 10:15] jorge
Line 6: Line 6:
  
 ===== Mirrors ===== ===== Mirrors =====
-As we have already mentioned in the introduction, AmbientTalk uses a mirror-based architecture to provide reflective access to its objects. The basic principle of a mirror-based architecture is that all reflective facilities are encapsulated in a mirror object which provides reflective access to precisely one object, its reflectee. Moreover, the mirror of the object is not directly accessible as a slot of the object. Instead, a separate factory must be used to create mirrors, which allows the program to hand out different mirrors according to the dynamic call chain, the requesting object etc. The factory can be used implicitly using the ''reflect:'' primitive. Once a mirror has been created, it can be used for instance to produce a listing of an object's slots, as is exemplified below.+AmbientTalk uses a mirror-based architecture to provide reflective access to its objects. The basic principle of a mirror-based architecture is that all reflective facilities are encapsulated in a mirror object which provides reflective access to precisely one object, its reflectee. Moreover, the mirror of the object is not directly accessible as a slot of the object. Instead, a separate factory must be used to create mirrors, which allows the program to hand out different mirrors according to the dynamic call chain, the requesting object etc. The factory can be used implicitly using the ''reflect:'' primitive. Once a mirror has been created, it can be used for instance to produce a listing of an object's slots, as is exemplified below.
  
 <code> <code>
 def baseObject := object: { def baseObject := object: {
   def field := nil;   def field := nil;
-  def canonicalMethod() { nil } +  def canonicalMethod() { nil }; 
-  def keyworded: arg1 method: arg2 { nil }+  def keyworded: arg1 method: arg2 { nil };
 }; };
 def mirror := reflect: baseObject; def mirror := reflect: baseObject;
Line 47: Line 47:
     } else: {     } else: {
       super^doesNotUnderstand(selector);       super^doesNotUnderstand(selector);
-    } +    }; 
-  }+  };
 } }
 </code> </code>
at/tutorial/reflection.txt · Last modified: 2010/11/16 16:32 by tvcutsem