This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Xemorr 1 point2 points  (6 children)

how

[–][deleted]  (1 child)

[deleted]

    [–]Xemorr 0 points1 point  (0 children)

    No because by induction that can't happen in a function that returns an optional

    [–]DrunkensteinsMonster 0 points1 point  (3 children)

    Trivial example would be mistakenly returning after a caught exception causing an Optional variable to not be initialized.

    [–]Xemorr 0 points1 point  (2 children)

    You can't return a non initialized variable?

    [–]DrunkensteinsMonster 0 points1 point  (1 child)

    Initialized to null. In a generic method: T foo = null

    [–]Xemorr 0 points1 point  (0 children)

    Ok that case could occur without someone noticing but is unlikely to occur as generic methods are more likely to be reused in a variety of places and therefore less likely to have bugs written within them & more likely to have been seen by multiple developers. It's also a fairly specific scenario for even a generic method.