Created
June 14, 2019 11:33
-
-
Save joseoliv/90a65d5a521c4bccf19ff6c1e9e12fb5 to your computer and use it in GitHub Desktop.
keepValue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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