y
11/07/2022, 2:07 PMT?
like an optional of type T
?Joffrey
11/07/2022, 2:10 PMT?
is meant to express "the nullable version of T, no matter whether T is already nullable or not". Note that an unconstrained T is already potentially nullable, depending on the type parameter that's actually passed in a specific usage of your generic declarationKevin Del Castillo
11/07/2022, 2:11 PMT
to T: Any
then you should be able to use T?
as an "optional" T
y
11/07/2022, 2:11 PMT
?y
11/07/2022, 2:12 PMval foo: Foo?
is nullable, but val foo: Foo
is not, correct?Kevin Del Castillo
11/07/2022, 2:12 PMy
11/07/2022, 2:13 PMJoffrey
11/07/2022, 2:13 PMFoo
is not nullable, Foo?
is nullable. Both can be passed as T
to a generic declaration if T
is not constrainedy
11/07/2022, 2:15 PMFoo
), I should use a Foo?
, correct?