Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2021
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1.  
  2. unit module TestImports;
  3.  
  4. sub bar is export { say "bar sub" }
  5. sub baz is export { say "baz sub" }
  6. my $var = 'He heu hey';
  7. my $aar = 'He heu hey';
  8. my $vaa = 'He heu hey';
  9. my $kar = 'He heu hey';
  10. my $vor = 'He heu hey';
  11. constant A = 333;
  12. constant APPART is export(:AP) = 174;
  13.  
  14. constant COLOR_A = 24;
  15. constant COLOR_B = 84;
  16. constant COLOR_C = 88;
  17. constant COLOR_D = 92;
  18. constant COLOR_E is export(:SPECIAL)= 144;
  19. constant COLOR_F = 98;
  20. constant COLOR_G = 118;
  21. constant COLOR_H = 214;
  22. constant COLOR_I = 800;
  23.  
  24.  
  25. my package EXPORT::MYTAG {
  26. #filter the colors;
  27. my %c = TestImports::.grep(*.key.match(/^ ( COLOR_ <[A..Z]>+ ) $ /));
  28. #filter allready in TAG exported : so we exclude those that we do not want.
  29. my %e = EXPORT::.grep( *.key.grep( none /^ : ( ALL || DEFAULT || MYTAG ) $ /));
  30.  
  31. #This nearly works but will fail for :SPECIAL Tag because it's yet exported :(
  32. for %c {
  33. next if .key eq 'EXPORT';
  34. .key.say;
  35. OUR::{.key} := .value;
  36. }
  37. #NOTE: So we must exclude, :SPECIAL (and ev. others) building a loop with e.
  38. #IF i did well red the doc ALL SPECIAL should be in GLOBAL::EXPORT::SPECIAL::%(kv);
  39. #and
  40. ::GLOBAL::EXPORT::SPECIAL::.raku.say => WORKS; ==> (COLOR_E(80)) SO:
  41. for %e.kv -> $k,$v {
  42. #HERE IS THE QUESTION!!!!!!
  43. ::GLOBAL::EXPORT::($k)::.raku.say; #SHOULD WORK but does not: WHY.
  44. }
  45.  
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement