Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package metaobjectTest
  2.  
  3.  
  4. @doc{*
  5. Annotation 'extract' is replaced by an Int value corresponding to
  6. its argument, which should be of the form 'int_value' or 'intvalue'.
  7. Example:
  8. assert extract(int5) == 5;
  9. assert extract(int_555) == 555;
  10.  
  11. This annotation is used inside a generic prototype to simulate
  12. the passage of an Int as argument:
  13. var v = MyVector(Int, int_100) new;
  14.  
  15. MyVector could have been declared as
  16.  
  17. object MyVector<T, V>
  18. var Array<T> array = Array<T> new: @extract(V);
  19. ...
  20. end
  21. *}
  22. object Extract
  23.  
  24. func run {
  25. var v = generic.MyVector<Int, int_100> new;
  26. }
  27.  
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement