Annotations

Per-object and per-slot annotations support:
  • Comments
  • Categories
  • Module information
  • Visibility declarations (private, etc.)
Set and accessed using mirrors.

All clones of an object share the same annotations, unless explicitly changed. Prototypes: objectAnnotation, slotAnnotation.

Annotations

Additional support for the programming environment is provided by annotations. Every object and every slot can have an associated annotation, which can be any kind of object. Self syntax only supports string annotations. However, mirrors allow you to set any kind of object as an annotation. Self 4.0 provides a structured, extensible annotation system to support comments, categories, privacy and module information. These are converted to and from strings when source is saved or loaded.

One caveat: a clone of an object shares the same annotations as the original. Although you can change the annotation in the clone, there is a space penalty for this.

The current uses for annotations are:

  • object and slot comments
  • slot categories
  • module information (see the section on the transporter, to come)
  • visibility declarations (i.e., private, public)

You can access the annotation of an object obj using this expression:

 	
	(reflect: obj) annotation 

And to access the annotation of a slot s in object obj, use this:

 	
	((reflect: obj) at: s) annotation

[ Previous ] [ Index ] [ Next ]