I have the following class: `class enum<T:Types...
# announcements
k
I have the following class:
class enum<T:Types<R>, R>(Name: String) : Types<R>(Name)
but is it possible to have the following
Copy code
val p = enum<varInt>("NextState"))

// instead of

val p = enum<varInt, Int>("NextState"))

// varInt
class varInt(Name: String) : Types<Int>(Name)
w
Do you mean you’d like to avoid repeating generic parameters if it should be possible to infer them from some other generic parameter? If so, there’s no way to do this that I know of, but I’d love to find out if it’s in fact possible
a
Maybe generic typealias?
k
What do you mean @alex009
w
typealias IntEnum = enum<varInt, Int>
so that you can write
val p = IntEnum("NextState")
. That would work only in case you use limited number of generic parameters
a
typealias TypeAlias<T> = enum<Types<T>, T>
but now i see that you want pass name to
Types<Int>
class...here typealias not help, yes