toNullable() specialization.#21
Conversation
|
interesting...i wonder if this would mean |
|
Without abstract With |
Egorand
left a comment
There was a problem hiding this comment.
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 ыы? |
arturdryomov
left a comment
There was a problem hiding this comment.
Looks good, let’s try it out.
Recent PR #20 made me rethink
toNullable(), I think it needs to be abstract with specialized implementation inSomeanNone.That gives following benefits:
instanceofcheck, 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 beSomeNote 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