by plus9z · 12y ago · 0 comments
I've not written any Swift code yet, so can someone enlighten me -- is this actually true? This seems unnecessarily restrictive (and absurd -- Swift can't tell if a pointer's being read?)
Swift can tell from static analysis if it might be read at compile time and raise an issue if it isn't initialised on all oaths to the access. If passed as an inout parameter it has to assume it may be read[0] and for safety require that it must be initialised.
[0] at least if it is calling into a library even if it can check the current version it couldn't know for sure that a different library version won't behave differently.