I noticed that even when you have a failable initializer that fails, you're suposed to bind all instance variables. For example:
class Foo {
let a :Int
let b : Int
init?(name: String, m: Int, n: Int){
if name != "fistro" {
a = m
b = n
}else{
return nil
}
}
}
The compiler complains that a and b are not set in the else path. Who cares???
So even when the instance of Foo is not valid and will not be used, the compiler insists in having those instance variables set to something.
Is this a bug or a feature? Is there any sense in forcing you to come up with some value in this situation?
IMHO this only forces you to use Optionals when they're not necessary. Unless someone can give a good explanation for why this is a good idea, I believe this behavior should change as it's a time waste and semantically incorrect.