Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
typing [2017/02/14 10:25] christian [PDF Object Types] |
typing [2017/09/27 18:45] (current) christian [Typed Attributes] |
||
---|---|---|---|
Line 32: | Line 32: | ||
The following pragmas are used for declaring a type: | The following pragmas are used for declaring a type: | ||
- | * **#type:** *aSymbol* The value (or references) should be of type aSymbol | + | * **#type:** *aSymbol* The value (or referenced value) should be of type aSymbol |
* **# | * **# | ||
- | * **# | + | * **# |
- | * **# | + | * **# |
- | * **# | + | * **# |
The pragmas can occur several times. One of the given types should apply. | The pragmas can occur several times. One of the given types should apply. | ||
Line 44: | Line 44: | ||
< | < | ||
</ | </ | ||
- | The symbol is the type name of the PDF object. So far, the type name corresponds to the class name in the Smalltalk implementation hierarchy. | + | This declares that the attribute # |
+ | * a Contents | ||
+ | * an array of Contents objects. | ||
A type of an object is used when it gets assigned to an attribute. With the type requirement of the attribute, the object is specialized to the attribute type if possible. If this is not possible, a TypeError is raised. | A type of an object is used when it gets assigned to an attribute. With the type requirement of the attribute, the object is specialized to the attribute type if possible. If this is not possible, a TypeError is raised. | ||
Line 84: | Line 86: | ||
Rectangle>> | Rectangle>> | ||
- | < | + | < |
^self at: 4 | ^self at: 4 | ||
</ | </ | ||
Line 134: | Line 136: | ||
</ | </ | ||
When an object is not a subclass of a type, it can be specialized if the objects class subsumes the type. | When an object is not a subclass of a type, it can be specialized if the objects class subsumes the type. | ||
+ | |||
+ | |||