NeosModLoader icon indicating copy to clipboard operation
NeosModLoader copied to clipboard

Add invocation helpers for (generic) methods (on generic types)

Open Banane9 opened this issue 2 years ago • 8 comments

Currently still without documentation, but the first goal would be to have other people look over the API.

And add a proper matcher for GenericTypeMethodsInvoker.GetGenericMethodOfConcreteTypeDefault 😂

Banane9 avatar Mar 11 '23 17:03 Banane9

Dang, that's more code than I expected. At a glance it doesn't look like any of your classes are public. Not sure if that's the intent?

Anyways, I'll take a more in-depth look a bit later.

zkxs avatar Mar 11 '23 18:03 zkxs

Missing docs/examples, which IMO makes having these as shared utilities in NML for mods pretty pointless.... Though I guess NML's API doesn't have proper generated docs to begin with, but IDEs usually can at least show the special C# doc comment XML monstrosities...

As I said in the original post, I wanted to get people's feedback on the capabilities / interface before spending time on documenting it extensively. However if you have any questions as to what it does I'd be happy to explain / go on discord

Banane9 avatar Mar 12 '23 15:03 Banane9

Though I guess NML's API doesn't have proper generated docs to begin with, but IDEs usually can at least show the special C# doc comment XML monstrosities...

takes off C# developer mask
I was actually a Java guy the WHOLE TIME! I've got no idea how to generate fancy docs from the scary XML comments. Also I hate XML and enjoy markdown.

As I said in the original post, I wanted to get people's feedback on the capabilities / interface before spending time on documenting it extensively. However if you have any questions as to what it does I'd be happy to explain / go on discord

I think the most helpful thing here would be an example or two on what a typical usage of this API would look like. No need to go crazy with the scary XML comments yet... especially because I'm pretty sure like 95% of mod devs don't actually know how to see the XML docs in their IDE. At least that's the vibe I get with some of the questions asked on the Discord.

zkxs avatar Mar 12 '23 16:03 zkxs

especially because I'm pretty sure like 95% of mod devs don't actually know how to see the XML docs in their IDE. At least that's the vibe I get with some of the questions asked on the Discord.

...usually just hovering over the methods should show a popup of the details if the comment is formed correctly.

I've got no idea how to generate fancy docs from the scary XML comments.

There's a few choices, though only one out of these that I've used before is doxygen... DocFX looks more modern though from a quick investigation.

l-2-j avatar Mar 12 '23 16:03 l-2-j

I think the most helpful thing here would be an example or two on what a typical usage of this API would look like.

Here's one for the GenericMethodInvoker: https://github.com/Banane9/NeosDynamicVariableLogger/blob/fa0f21ee2cf0c50af83770c47448a54cea2febc9/DynamicVariableLogger/DynamicVariableLogger.cs#L132

I've used it some more in the CustomEntityFramework to help with the invocation of Methods<> on DynamicVariableSpace and while patching DynamicImpulseTriggerWithValue<>, but @KyuubiYoru still need's to set that repo to public.

Banane9 avatar Mar 12 '23 16:03 Banane9

...usually just hovering over the methods should show a popup of the details if the comment is formed correctly.

that only works in the same project, otherwise you need to enable the Documentation file option under Build > Output in the Properties and have it along side the file. Option in VS

Generating the pdb information (and embedding it?) may also be a helpful idea (for a dev version anyways).

Banane9 avatar Mar 12 '23 16:03 Banane9

Here's another example of the GenericMethodInvoker: https://github.com/KyuubiYoru/CustomEntityFramework/blob/a9791a41380ff46b8de2bde5e586f291555d108c/CustomEntityFramework/Functions/DynamicVariableSpaceWrapper.cs#L208-L239

And of the GenericTypeMethodsInvoker: https://github.com/KyuubiYoru/CustomEntityFramework/blob/a9791a41380ff46b8de2bde5e586f291555d108c/CustomEntityFramework/Functions/CustomFunctionLibrary.cs#L130

Banane9 avatar Mar 12 '23 16:03 Banane9

there you go @ljoonal, I made sure the doc will actually be useful now, too ;)

Banane9 avatar Mar 13 '23 01:03 Banane9