Skip to content
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

IDL: enum inheritance support #70

Open
ratoshniuk opened this issue Apr 4, 2019 · 2 comments
Open

IDL: enum inheritance support #70

ratoshniuk opened this issue Apr 4, 2019 · 2 comments
Assignees

Comments

@ratoshniuk
Copy link

For example, if we need to have some generic logic for components where we need to work with same enums. It would be nice to have a chance to inhetic enums as well.

For example

module1

enum Module1FilterCondition {
    AnyField
    FieldA 
}

module2

enum Module2FilterCondition {
    AnyField
    FieldA
    FieldB 
}

in scala code, we want to perform sorting by requested fields.
And as there are two absolutely different types we need to duplicate two functions

def filterModule1EntitiesBy(filters: List[Module1FilterCondition])
def filterModule2EntitiesBy(filters: List[Module2FilterCondition])

We could have a chance to do following:

  1. Define basic enum
enum BasicFiltering {
    AnyField
}
  1. Inherit module 1 and 2, respectively:
enum Module1FilterCondition {
    &BasicFiltering
    FieldA 
}

module2

enum Module2FilterCondition {
    &BasicFiltering
    FieldA
    FieldB 
}
  1. After that, we can provide genericFunction
def someCommonLogicOverFilteringRules[T <: BasicFiltering](t: T) : Result = ???
@ratoshniuk
Copy link
Author

@pshirshov Or we can just create some type class and forget about what i said

@pshirshov
Copy link
Member

It supported in V2.
You may bring it into v1 also. Should be doable.

@neko-kai neko-kai transferred this issue from 7mind/izumi Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants