Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Last active June 24, 2019 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/3982735ed2d9717852cfe4b434e1eb50 to your computer and use it in GitHub Desktop.
Save joseoliv/3982735ed2d9717852cfe4b434e1eb50 to your computer and use it in GitHub Desktop.
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