-
Notifications
You must be signed in to change notification settings - Fork 21
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
toNullable() specialization. #21
toNullable() specialization. #21
Conversation
interesting...i wonder if this would mean |
Without abstract With |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. Having Some.toNullable()
return T
rather than T?
is definitely a win. As for component1()
, I don't think it makes sense in None
, so it should be specific to Some
.
But #20 adds |
@ming13 @dmitry-novikov @nostra13 can you PTAL ыы? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let’s try it out.
Recent PR #20 made me rethink
toNullable()
, I think it needs to be abstract with specialized implementation inSome
anNone
.That gives following benefits:
instanceof
check, likely JIT or AOT were specializing the function for us, but now we do it at compile timeSome.toNullable()
. It lets compiler statically figure nullability if type is known to beSome
Note that because of nullability change in
Some.toNullable()
the change is API incompatible, but ABI compatible so we're still allowed to release it in a minor update.cc @Egorand, @AlecStrong