I hadn't posted or done anything about partial class support because it just doesn't seem useful enough.
I personally don't like the keywords
partial class, because to be semantically correct, the parser must require that there is more than one
partial class. Other ideas like
extends class x or
class x extended imply that the parts must be defined in a specific order. This restrictions would add to code and documentation size while providing little or no benefit. The alternative is to not enforce restrictions based on correct English, and deal with the consequences. (Arguments about #Include
Again come to mind.)
In C#,
partial is required to appear on
all parts of the class. Ruby has the concept of "open classes", which, for instance, could allow you to define extensions to the built-in classes directly using class syntax instead of assignments/DefineProp. (I think the concept is basically that all classes are open, or that
class x "opens" a class, not necessarily defining a new one.)
However, this is not exactly elegant as the included files will in themselves not have any reference to the class they are defining.
I think it is elegant to use a simple language feature for the purpose it was intended; splitting a large script into a set of smaller files.
The code within the class has the same behaviour regardless of whether it is physically located in the same file or not. I assume that by "reference to the class" you mean that the code will not be enclosed by
class ClassName {...
}. I don't think I would describe this repetition as being
less elegant. If you want the file to show which class the methods belong to, you can simply write a comment, or it can be implied by the filename.
Depending on personal style, enclosing the file's content in
partial class ClassName {...
} probably also implies an extra level of indentation across the whole file, or a small inconsistency to code style. I would consider that a drawback.
Perhaps more importantly, the use of #Include in a class prevents AutoHotkey2 LSP (and likely similar tools) from correctly deducing scope, providing relevant auto-completion options, identifying methods as methods (not functions), etc.