Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
Let's imagine we want to hold a password where nobody can hack it. In C++ we would probably use a static class member :
class Wooity {
static char password [12];
Wooity() {password = "URAP065"; // Obviously not my real password :)
}; char* operator()() {return password;}
};
We can similarly do this in ::SHE+ILA:: by embedding the static hidden variable into a class factory, or we can use a nested function where the outer function declares the password and the inner function references it. This ensures that the password outlives the scope of the inner function, since it is in the scope of the outer function. We would call the outer function at startup, thus instantiating its scope, and make the outer function return a readonly reference to the inner function :
Wooity <:: & { (password = "SWORDFISH");
Hoo <:: [](){ password };
};
To get the password we now say
ttyout (Wooity!Hoo);
This feature is subject to change as it is still under development :)