Is there any way that I can use `<reified T>...
# announcements
j
Is there any way that I can use
<reified T>
with a
sealed class
?
d
Can you elaborate? The two concepts do not really interact with each other.
m
You can only reify type parameters on inline functions. So type parameters on the class level can't be reified.
👍 1
s
EDIT: What they said. ⬆️ Reified generics types are a feature that comes with inline functions which let's you “circumvent” type erasure. It doesn't really have anything to do with whether a class is sealed, abstract, open, closed, what-have-you …
j
I do understand that basic concept, and I figured that this was the case. But I would like it if I could somehow instantiate a class that takes a Generic type input without needing to also pass the class reference. I have tasted reified type’s convenience in my functions and now I want it in my classes 😅
k
Write a reified factory function that then calls an uglier constructor.
j
That’s an idea, thanks. Will give it a shot.