Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
keepValue
package metaobjectTest
@doc{*
Annotation 'doc' can be attached to any declaration, including
the program and packages
This metaobject generates code that writes to a file the value
of a local or field that is parameter to the annotation.
In fact, the last five values of the variable are kept in the file,
which is specific to every variable. The
file is keepValue_varName.txt in the directory --tmp of a directory
whose name is the prototype in which the annotation is.
*}
object KeepValue
func run {
7 times: {
var Int r = Math randomInt;
// record the last five random numbers in the file
@keepValue(r);
}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.