You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In almost all cases of code that looks like this, the author is not aware that ? implicitly turns basic types into Null<T> (non-basic types too, but that shouldn't really have any run-time implications for those).
functionfoo(?arg:Int=0) {} // the user probably didn't want a nullable type here
Nullable basic types on their own are fine, but them being nullable is pointless if they have a non-null default value as well. You can't get the argument to be null anyway (see here).
Note that there may be a use-case for nullable basic types with default-values if you want them to be skippable (skipping is only allowed for nullable arguments).
The text was updated successfully, but these errors were encountered:
In almost all cases of code that looks like this, the author is not aware that
?
implicitly turns basic types intoNull<T>
(non-basic types too, but that shouldn't really have any run-time implications for those).Nullable basic types on their own are fine, but them being nullable is pointless if they have a non-null default value as well. You can't get the argument to be null anyway (see here).
Note that there may be a use-case for nullable basic types with default-values if you want them to be skippable (skipping is only allowed for nullable arguments).
The text was updated successfully, but these errors were encountered: