-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Less verbose way of initializing a Nullable field to null #9364
Comments
I think my vote is to define Another possibility is |
|
Linking #9356 - it will be good to have the same term for initialization as well as printing. |
I think adding |
It's just the empty set, so we naturally conclude that the set of values you can get from |
@johnmyleswhite I'm not sure if you'd consider this a part of the type inference system, but if you wanted to know whether e.g. a field of type |
We could probably improve this to also avoid storing fields of type |
+1 for |
Ok, I'm onboard with This still leaves the original question of shorter syntax for nullable fields in types and also the related question of achieving shorter printing for nullable values in #9356 . |
Hey, we are constantly progressing towards a successful consensus! :-)
I don't think so. With
Right. |
I am actually OK with the syntax of specifying it. I was more concerned with initializing it to I guess printing too can print |
Ah, ok. I thought you wanted something like: type Foo
a::Int?
end |
That would be nice too. :-) |
I also felt the need to initialize
Admitedly this doesn't happen as often as with |
That seems a little too magical for my tastes. |
@JeffBezanson "My opinion is heavily that way". :-) I really prefer |
This issue is to track and generate consensus on having a simpler method to nullify a Nullable field.
If we have a type with a large number of Nullable fields that we want to initialize with empty values:
the current method involves having the constructor as
Foo() = new(Nullable{Int}(), Nullable{Bool}(), Nullable{AbstractString}().... )
. For a large number of fields it involves matching the Nullable container type in the constructor and can be a bit painful.See issues #9351, #8423 for the previous discussions about this.
The text was updated successfully, but these errors were encountered: