Forums

nil checking

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Re: nil checking

Postby nerdzero » Sun Jan 13, 2013 4:25 pm

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 :)
nerdzero
 
Posts: 286
Location: Chicago, IL

Previous

Return to Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron