VL-Language icon indicating copy to clipboard operation
VL-Language copied to clipboard

Working with Interfaces

Open kopffarben opened this issue 9 months ago • 1 comments

Working with Interfaces

VL supports interfaces, which works well, but working with interfaces is, let's say, anything but optimal. I'll just say that a few small changes, especially to the UI, would make working with interfaces much easier.

Especially in view of the upcoming release, it would be nice and desirable if a few small changes could make it into the release.

I'm just trying to start a discussion here about what could be improved. Here are my ideas, in ascending order of how difficult they are to implement.

One of the big problems with the current implementation is that when you add an interface you have no idea which methods to implement.

1. Open Interface with MiddleMouseButton

Image

  • 1.1. VL Interface: no problem, should be easy to implement

  • 1.2. C# interface referenced by source, i.e. referenced by *.csproj or *.cs, shouldn't be that complicated either.

  • 1.3. compiled C# interface, does not work of course

2. Mark methods which are implemented from an interface in the operations. Would improve the overview considerably.

Image

  • 2.1. e.g. MyInterfaceName.MyInterfaceMethod

3. automatically add the methods of an interface to the operations

Image

  • 3.1. When I add an interface, the methods should automatically appear in the operations, preferably grayed out until I assign something to the methods in the patch. This would simplify the patcher life so much.

4. default interface methods

Image

  • 4.1. Since the interface patches basically work in the same way as the class patches, it would be relatively easy to assign a default implementation to the methods, at least on the editor side. Since C# as of net.8.0 also supports this, it should theoretically be possible. And you would at least have something like a very limited inheritance; it is clear that the default methods do not have access to the fields and the properties, but you could also help yourself with interfaces, at least in a makeshift way.

    I don't want to open up the big topic of inheritance, which I personally really miss, because it restricts access to some nugets that are based on base classes. I just wanted to mention it.

But that's enough about interfaces for now.

kopffarben avatar May 21 '25 11:05 kopffarben

good stuff. All of it makes much sense. We'll discuss internally.

I don't want to open up the big topic of inheritance, which I personally really miss, because it restricts access to some nugets that are based on base classes. I just wanted to mention it.

relates to #54

gregsn avatar May 21 '25 23:05 gregsn