Closed passsy closed 4 years ago
CI works now, except for codecov upload where I don't have the rights to upload.
CI works now, except for codecov upload where I don't have the rights to upload.
Yeah, need to fix that CI script :smile: Btw do you mind becoming a collaborator for super_enum?
@passsy Have you checked "Revivable" objects? It may be possible to completely avoid wrappers and directly recreate the injected classes.
I thought about calling the constructor on my own but it gets hard to pick the right one when a class has multiple.
Also constructors might be private or instances may only be created by a factory or is a singleton. Only the user knows how to create the wrapped objects.
~Getting rid of the Wrapper might be possible with is
checks rather than using a switch case on the _type
. But it's an implementation detail which an be changed later. (assuming nobody uses if (result is MySuccessWrapper)
)~
Getting rid of the Wrappers is impossible. The types have to extend the base type. And we can't change what the @UseClass
classes extend.
But it's an implementation detail which an be changed later. (assuming nobody uses if (result is MySuccessWrapper))
This was my concern. Let us explore a little more and see if we can improve the code and avoid the wrapper situation before merging.
I don't see how we could get rid of the wrapper. The types have to extend the base type. We can't change what the @UseClass
classes extend. That's why we need a wrapper so that the returned types always extends the Result
type.
@passsy I think we can merge this PR for now. It's a go from my side too.
fixes #29
By only using
@UseClass
it is relatively easy to create union types. Pretty cool :)Generates
Usage