|
I do think partial classes are a very useful feature and it will certainly be part of boo some time soon.
I'm still not sure if requiring the 'partial' keyword in the type declaration is the way for boo to go. I would like us to be able to do things like the following eventually: namespace System class String: Open classes. I'm sure I'll be in a better position to suggest something more concrete after the PDC. If we decide to go with the 'open classes' approach, this code will be legal.
Yeah, sounds interesting. Multimethods for adding methods to external classes maybe, and implicit partial classes for combining internal classes like this patch.
This version of the patch works the same as before but doesn't require any partial keyword, if it is useful. I think the partial keyword should be required.
It allows you to quickly see that a class is NOT partial, so you don't have to spend time searching the other parts. That is good both for humans and IDE's. And if you need a partial class, it's only 7 letters to add. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-only class defintions (i.e. not structs, interfaces, or enums) can be declared partial.
-partial classe defintions can appear in the same file, in different files, or both.
-Nodes from all the files are simply concatenated together, so that if you declare foo() in 2 partial classes, the error will read like you had declared the same function within one traditional definition.
-You can declare base classes or interface implementations on any of the partial class definitions. All such declarations will be unioned, that is, the following is valid:
partial class foo (someInterface):
pass
partial class foo (someInterface, someInterface2):
pass
the merged class foo will implement both someInterface and someInterface2. If 2 or more different base classes are declared in each partial definition an error will be thrown just like you had declared 2 base classes in a full definition.