SHARE
TWEET

Store class var dict

a guest Oct 11th, 2018 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* THE CLASS */
  2. StoreThis {
  3.     classvar <>storage;
  4.  
  5.     //this class is run during library compile time.
  6.     *initClass{
  7.         //this method makes sure that the IDict is compiled before
  8.         //trying to make an instance of it
  9.         Class.initClassTree(IdentityDictionary);
  10.  
  11.         storage = IdentityDictionary.new;
  12.     }
  13.  
  14.     *adder {|addThis|
  15.         "adding: %".format(addThis).postln;
  16.  
  17.         // i originalen var denne initiert til 'nil'
  18.         //storage = addThis.asEvent ++ storage.asEvent;
  19.         //ta en titt paa denne forskjellen:
  20.         //funker ikke
  21.         // (hej: "hello", yo: "hej") ++ nil;
  22.         //funker
  23.         // [hej: "hello", yo: "hej"] ++ nil;
  24.  
  25.         //kan alternativt bruke denne:
  26.         storage.putAll(storage.asEvent);
  27.  
  28.  
  29.         "resulting storage: %".format(storage).postln;
  30.     }
  31.  
  32. }
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
 
Top