SHARE
TWEET

Untitled

a guest Jun 17th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package metaobjectTest
  2.  
  3.  
  4. @doc{*
  5.   Annotation 'letter' should be attached to a Char in a variable
  6.   declaration. It checks whether a value assigned to the
  7.   variable is a letter.
  8. *}
  9. object Letter
  10.  
  11.     func run {
  12.         var Char@letter ch;
  13.         ch = 'a'; // ok
  14.         var Char other = '#';
  15.         var ok = false;
  16.         {
  17.             ch = other; // runtime error
  18.         } catch: { (: CyException e :)
  19.              ok = true
  20.         };
  21.         assert ok;
  22.    
  23.     }
  24.  
  25. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top