eugenesv wrote: ↑22 Sep 2023, 04:40
Unfortunately requiring accounting for a hidden
this is not simple,
It is very simple. Whether you can personally remember to account for it is a different matter.
The solution to issues with dead code is eliminating dead code
You must have misunderstood my point. Read the example I gave. Dead code has nothing to do with it.
Why can't the default be that this is myClass unless overriden?
I already gave at least one answer for this.
How or when would it default or be overridden? If it binds the parameter automatically, how would it determine when the caller is trying to override it?
If you believe it can be done without breaking scripts, show us. You can change the behaviour of the property corresponding to a method by using DefineProp. You can do this for all methods via
static __New and OwnProps, although if you only apply it to your own classes, it won't prove much.
[Python] static methods explicitly don't even have self
So static methods in Python don't automatically bind
self, because they don't have
self. AutoHotkey static methods have
this, as I already pointed out. Scripts rely on it. Scripts also rely on
myClass.getKey or similar returning the function object with nothing bound to
this.