Page 2 of 2

Re: nil checking

PostPosted: Sun Jan 13, 2013 4:25 pm
by nerdzero
Charles wrote:...
3)
Regarding:
if true
foo = Foo()
.takesNonNilFoo(foo)

The correct behavior should be an inferred type of Foo (non-nilable) and an error that it was used uninitialized.

It should be an error if you try to use a non-nilable reference variable that might not be initialized.

Maybe it should also be an error for value variables as well. That's debatable.

I don't want to change the inference to nilable because I would just end up changing it back when the code flow analysis and error checking improved.


Fair enough. I'll shut up now :)