Difference between revisions of "Transient Attributes"
m (Volatile Attributes moved to Transient Attributes: Better naming of mechanism) |
(Renamed volatile into transient) |
||
Line 1: | Line 1: | ||
[[Category:Compiler]] | [[Category:Compiler]] | ||
[[Category:Runtime]] | [[Category:Runtime]] | ||
− | For storable purposes, it makes sense that some attributes of objects are not stored to disk. We call them | + | For storable purposes, it makes sense that some attributes of objects are not stored to disk. We call them transient attribute and currently are specified using a note clause: |
<e> | <e> | ||
field: detachable X | field: detachable X | ||
note | note | ||
− | option: | + | option: transient |
attribute | attribute | ||
end | end | ||
Line 12: | Line 12: | ||
== Validity Rule == | == Validity Rule == | ||
− | An attribute can be marked ` | + | An attribute can be marked `transient' if and only if: |
# its type has a default value (i.e. it cannot be a formal or an attached type) | # its type has a default value (i.e. it cannot be a formal or an attached type) | ||
# it is not a user defined expanded type | # it is not a user defined expanded type | ||
Line 18: | Line 18: | ||
== Rationale of validity rule == | == Rationale of validity rule == | ||
− | If the type did not have a default value (which is the case for attached types), then upon retrieval the | + | If the type did not have a default value (which is the case for attached types), then upon retrieval the transient attribute would be Void which is against void-safety. |
For simplicity and backward compatibility of `basic_store' which does a memory copy of the object to disk, it would be quite complicated to implement when expanded are involved. We prefer our users to use SED once it supports expanded. | For simplicity and backward compatibility of `basic_store' which does a memory copy of the object to disk, it would be quite complicated to implement when expanded are involved. We prefer our users to use SED once it supports expanded. | ||
== Semantic == | == Semantic == | ||
− | The | + | The transient property of an attribute declared in a class A keeps its transient property in descendants of A unless the attribute is redefined. |
Latest revision as of 07:20, 6 July 2009
For storable purposes, it makes sense that some attributes of objects are not stored to disk. We call them transient attribute and currently are specified using a note clause:
field: detachable X note option: transient attribute end
Validity Rule
An attribute can be marked `transient' if and only if:
- its type has a default value (i.e. it cannot be a formal or an attached type)
- it is not a user defined expanded type
- the enclosing class is not expanded
Rationale of validity rule
If the type did not have a default value (which is the case for attached types), then upon retrieval the transient attribute would be Void which is against void-safety.
For simplicity and backward compatibility of `basic_store' which does a memory copy of the object to disk, it would be quite complicated to implement when expanded are involved. We prefer our users to use SED once it supports expanded.
Semantic
The transient property of an attribute declared in a class A keeps its transient property in descendants of A unless the attribute is redefined.