We need a method modifier that denotes methods that do not reference the heap.
This is an element of specification in that it lies at the interface of the method -- and can be used by clients and verified against the implementation.
A method marked this way is known to be independent of the heap -- so its value (for the same arguments) does not change when the heap changes. This means also that it does not depend on fields of any reference-type arguments.
All operations on builtin mathematical types are in this category.
Also, operations on 'immutable' types such as String and integer, whose heap state, if any, is unobservable by anything else.
The question is: how should this be specified in JML.
- OpenJML is using
function
- I think KeY is using
no_state
- And does
reads \nothing (that is accessible \nothing;) accomplish the same goal, if more obscurely?
We need a method modifier that denotes methods that do not reference the heap.
This is an element of specification in that it lies at the interface of the method -- and can be used by clients and verified against the implementation.
A method marked this way is known to be independent of the heap -- so its value (for the same arguments) does not change when the heap changes. This means also that it does not depend on fields of any reference-type arguments.
All operations on builtin mathematical types are in this category.
Also, operations on 'immutable' types such as String and integer, whose heap state, if any, is unobservable by anything else.
The question is: how should this be specified in JML.
functionno_statereads \nothing(that isaccessible \nothing;) accomplish the same goal, if more obscurely?