[swift-evolution] proposal for a even simpler guard.. => guard!

Dominik Pich dominik at pich.info
Mon May 2 15:15:35 CDT 2016


yes. true. that’d be also totally fine.

my main issue is to make unwrapping easier ;)

> On May 2, 2016, at 9:57 PM, David Waite <david at alkaline-solutions.com> wrote:
> 
> By existing semantics of the exclamation mark, ‘guard!' would be expected to cause the application to fail fatally, not throw. This is the same as try!.
> 
> -DW
> 
>> On May 2, 2016, at 1:09 PM, Dominik Pich via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> Hello,
>> often the guard statement is used to only unwrap optionals. multiple guards will cause a lot of ‘overhead’.
>> also often if it doesn’t work. there is no easy way we can gracefully recover ;)
>> 
>> so how about we do the same as with try/catch where you can use try! and have a guard!
>> 
>> the guard! could just throw an exception …
>> 
>> regards
>> Dominik
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160502/d79d7247/attachment.html>


More information about the swift-evolution mailing list