#pragma once // Transition from global 'self' to local 'this' // Step 1: auto oldself #if 1 #define SELFPARAM() noref const entity this = self #endif // Step 2: const self #if 1 #define self (0, self) [[alias("self")]] entity __self; #define setself(s) (__self = s) #define WITHSELF(value, block) WITH(entity, __self, value, (0, block)) #endif // Step 3: propagate SELFPARAM() #if 1 #undef self #define self (this, self) #endif // Step 4: kill unstructured setself #if 0 #undef setself #endif // Step 5: this should work #if 0 #define self (0, this) #endif // Step 6: Remove SELFPARAM in favor of a parameter