Does anyone think C#'s partial would have any use in D?

Dr Machine Code jckj33 at gmail.com
Sun Dec 19 04:24:30 UTC 2021


 From official C# docs, it can be useful such as:


* When working on large projects, spreading a class over separate 
files enables multiple programmers to work on it at the same time.
* When working with automatically generated source, code can be 
added to the class without having to recreate the source file. 
Visual Studio uses this approach when it creates Windows Forms, 
Web service wrapper code, and so on. You can create code that 
uses these classes without having to modify the file created by 
Visual Studio.
* When using source generators to generate additional 
functionality in a class.
To split a class definition, use the partial keyword modifier, as 
shown here:

source: 
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/partial-classes-and-methods

Does anyone thinks C# would benefit of having this keyword? I 
think it was mostly implemented to make it easier the Visual 
Studio's code generator. Can't think much of it. But give D 
doesn't have even multiples inheritances, it's unlikely to be 
appreciated but just like to know you all opinions


More information about the Digitalmars-d mailing list