[swift-evolution] [Proposal] Remove force unwrapping in function signature.
Saagar Jha
saagarjha28 at gmail.com
Wed Jul 20 23:26:10 CDT 2016
To use the parameters, the function would have to check for nil anyways, right (or risk a crash at runtime)? If the parameter is changed from an IUO to an Optional, the check for nil simply becomes a shadowing with guard.
Saagar Jha
> On Jul 20, 2016, at 21:10, Chris Lattner <clattner at apple.com> wrote:
>
>
>> On Jul 20, 2016, at 5:24 PM, Saagar Jha <saagarjha28 at gmail.com <mailto:saagarjha28 at gmail.com>> wrote:
>>
>> Sorry for the last email…I didn’t see your response.
>>
>> I realize that disallowing IUOs in parameters (but not as properties) is inconsistent, but IUOs for properties make sense: they must be set during initialization, but sometimes this isn’t possible. IUOs make it possible to use the property just as any other non-Optional one, provided the property is set before it is used (see the proposal). This kind of guarantee doesn’t work for function parameters and return values.
>>
>> As for IUOs for non-audited methods; why can’t they just all use Optional parameters? It should have the same behavior as before, since you can pass in both an Optional as well as a non-Optional even today.
>
> Because an override of an unaudited method has to *use* the parameters.
>
> -Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160720/efe91d74/attachment.html>
More information about the swift-evolution
mailing list