Last active
June 24, 2019 23:18
-
-
Save joseoliv/3982735ed2d9717852cfe4b434e1eb50 to your computer and use it in GitHub Desktop.
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 'letter' should be attached to a Char in a variable | |
declaration. It checks whether a value assigned to the | |
variable is a letter. | |
*} | |
object Letter | |
func run { | |
var Char@letter ch; | |
ch = 'a'; // ok | |
// compile-time error if uncommented | |
// ch = '#'; | |
var Char other = '#'; | |
var ok = false; | |
{ | |
ch = other; // runtime error | |
} catch: { (: CyException e :) | |
ok = true | |
}; | |
assert ok; | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment