While I now after some thinking and reading (https://autohotkey.com/board/topic/87951-argh-reason-why-variables-need-a-const-flag-or-a-non-hideable-flag-or-maybe-a-namespace-mechanism-or-perhaps-some-combination-of-the-3/) understand the rationale behind allowing to overwrite the super global class definitions and marvel at the theoretical possibilities of it, I somehow still doubt, it's what the average programmer has in mind when typing some local variable name into a function. This behavior is also bound to cause hard to find problems eventually when a class name is used by random chance as a variable in somebody else's library code. Most code I see around does not declare every local variable as explicitly local, which would be the only way to be safe from this.
So my suggestion: Would it be possible to add a warning to #Warn when a class name is being assigned to like a normal variable to make this kind of thing easier to spot?
This would in my opinion fit with #Warn in the spirit of the LocalSameAsGlobal warning to point out code that is probably a mistake.
Furthermore it would be nice if the possibility of redefining any class definition at run time would be documented more clearly in the manual. Unless I completely overlooked it, this is only documented for the default base object, which is a rather specific case.
Thanks for considering this.
Here's some code to illustrate the behaviors:
z.hello("no more hellos from here.")
test.Hello("works seemingly fine for the first couple of thousand times, then crashes the script.")
msgbox, Hello %Txt%