https://pulumi.com logo
#dotnet
Title
w

worried-city-86458

09/15/2020, 3:35 AM
It would help even more with Kubernetes types used to express yaml equivalents... just need to improve the Pulumi C# types. What do you reckon, @tall-librarian-49374?
t

tall-librarian-49374

09/15/2020, 5:39 AM
Yeah… We can’t get rid of input types I’m afraid.
w

worried-city-86458

09/15/2020, 5:45 AM
I'm not suggesting that, rather they should somehow play nice with target typing, probably by having a default ctor but I'm not sure of the implications.
t

tall-librarian-49374

09/15/2020, 5:59 AM
The default constructor isn’t enough, right? The generic type doesn’t have the properties that you set. Compiler should somehow be instructed to instantiate the
T
type directly, not
Input<T>
w

worried-city-86458

09/15/2020, 6:02 AM
Yeah I think you're right. The
Input<T>
is relying on implicit type conversion. The thing is you only ever instantiate
T
directly, otherwise you're passing an
Output<T>
from upstream.
I can't see an easy way to do it since
Input<T>
can't derive from
T
, so it would have to compose / wrap
T
instead, effectively lifting the properties of
T
. That would require either dynamic dispatch or code generation.
Let me know if you have any ideas
t

tall-librarian-49374

09/15/2020, 6:26 AM
We do a similar codegen for Go, so it is possible, but I’m not sure if it would be a good thing for C#. Go doesn’t have generics, so options are limited.
w

worried-city-86458

09/15/2020, 6:26 AM
IIRC the typescript support lifts properties, which is nice to have as it makes
apply
etc go away.
... so there would be other "benefits"
t

tall-librarian-49374

09/15/2020, 6:29 AM
TypeScript has a language feature for that