Is the Swift idea of “implicitly deployable options” the same as Java “autoboxing” integers? The following runtime exception is only possible in Swift if xObjan "implicitly deployed variant" is declared:
Integer xObj = new Integer(-1);
xObj = null; // could do this with an implicitly unwrapped optional as well.
Integer.valueOf(xObj); // <-- exception. Integer.valueOf(int x); couldn't deal with this.
The bottom line is that “implicitly expandable options” MAY be zero, but you'd better be careful and not use them when a non-null reference is expected, right?
source
share