Bug 6182 - Partial methodmaps
Partial methodmaps
Status: NEW
Product: SourceMod
Classification: Unclassified
Component: Transitional API
1.7 branch
All All
: P5 enhancement
Assigned To: SourceMod Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-10 16:57 PDT by Ryan Stecker [:VoiDeD]
Modified: 2014-07-10 17:34 PDT (History)
2 users (show)

See Also:


Attachments

Description Ryan Stecker [:VoiDeD] 2014-07-10 16:57:36 PDT
It would be a neat feature to be able to split methodmaps among different files within a plugin, ie:

// a.inc
partial methodmap Object
{
    public void SomeFunc();
};

// b.inc
partial methodmap Object
{
    public void OtherFunc();
};

Similar to c#'s partial classes: http://msdn.microsoft.com/en-us/library/wa80x488.aspx
Comment 1 David Anderson [:dvander] 2014-07-10 17:34:30 PDT
In principle, I like the idea, and members of the dev team mentioned it as a possibility as well. Methodmaps are closer to C# extension methods, except that we only allow one block of them. I can guarantee we'll see extension methods on classes someday.

The reason I'd prefer not to do it now is that methodmaps are intended to serve a very limited purpose in transitioning to an object-oriented API. If they deviate too far from classes, then we have to guarantee those features for classes, and I don't want to lock the type system into something we may not want to implement in a new compiler. I don't want to make the mistake of going too far in a hacky system and then having to preserve behavior we didn't fully specify or develop.

I'm hugely in favor of extension methods - not sure about the utility of partial class. I'm interested in structural subtyping too which is related. They all require more careful type systems and for now I'm going to wait on a new compiler.

Note You need to log in before you can comment on or make changes to this bug.