Guest User

Untitled

a guest
Jun 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. my @package-ish = do given Metamodel {
  2. $_<
  3. PackageHOW
  4. ModuleHOW
  5. ClassHOW
  6. GrammarHOW
  7. CurriedRoleHOW
  8. ConcreteRoleHOW
  9. ParametricRoleHOW
  10. ParametricRoleGroupHOW
  11. >;
  12. }
  13.  
  14. sub is-package($object) is export {
  15. !$object.defined && $object.HOW ~~ any @package-ish;
  16. }
  17.  
  18. # These are package-like objects. Not sure if Nil should count or not.
  19. do .&is-package for class {}, package {}, role {}, IO, Int, GLOBAL, Proc, X, Nil;
  20.  
  21. # These are not packages
  22. do .&is-package for "", 7, [], {}, /asdf/, &substr, :(Int, Str), \(1, 2, 3);
Add Comment
Please, Sign In to add comment