On Fri, Jun 28, 2019 at 1:59 AM nate lust firstname.lastname@example.org wrote:
d = a + b + c print(d)
tmp = a + b d = getcloaked(tmp) + c prtint(d)
Now the behavior is the same as the first case, as getcloaked returns the metavariable that has not been bound to a name and so it is loaded right on the stack.
Or is it getcloaked("tmp"), which has to magically locate something by name? Because calling getcloaked(tmp) would have to call __getself__. Unless it's a magical construct.
In any case, you make it so that ANY refactoring has to call getcloaked, just in case there's a __getself__ lurking in the wings. That's a pretty terrible cost.
There are two (three) important cases when I have exempt __getself__ from being called. First is when an object is used in methods defined within itself. This means that self can be used when defining methods without triggering recursive behavior. The other cases are calling or returning from a function. This is to ensure the following say consistent.
f1(): x = MetaVar() return x
f2(): return MetaVar()
In f1 the return function evaluates if its return argument is the result of a metavar __getself__ call and if so, returns the metavar instead.
Eww. Extremely magical.
And, remind me, what problem(s) is __getself__ solving?