-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add proper inheritance support for remote objects in clients #8
Comments
Duplicate of krpc/krpc#63 |
I agree this would be a good addition. I will draw up a design for this. |
I think we should require explicit KRPCClass annotations on all classes that you want to be exposed to clients. That way you have complete control over what's exposed. For example, you might have base class A, and classes B, C and D that derive from it. You might want to expose A, B and C to the client but not D. What we need to implement is:
Open questions:
|
It's been a long time since I wrote this request, so I don't remember all details about how I imagined certain things to function.
|
I agree we should just try and follow C# rules. I think this will be fine for most clients that support OOP. The interesting one would be the Cnano client. I think it'll be doable though. I'll have a go at a proof of concept implementation. |
In my service, I have classes which share common functionality, so I set up an inheritance hierarchy. However, this hierarchy is not preserved when I generate client code. Instead, the common functionality is duplicated for each derived class annotated with
KRPCClass
which prevents me from using benefits of inheritance on the client side, such as creating a list of objects with the same base class. Although not all languages may support inheritance, it would be nice to have it at least in languages which support it.After doing some research, I believe the following parts would need changing to support this feature:
KRPCClass
To conclude my examples below, if a base class have
KRPCClass
annotation, all classes derived from it should be exported and create a correct hierarchy. The derived classes do not need to haveKRPCClass
annotation. This is just my opinion on how I would use the API, and I welcome further discussion.I would love to help with the implementation but currently I am having issues with making this project compile on Windows. I think I am missing some dependencies but I don't know which ones exactly.
Examples:
How I would use it in Java:
The text was updated successfully, but these errors were encountered: