[swift-evolution] [Discussion] "try" for function that does not throw

Ben Rimmington me at benrimmington.com
Thu Jul 7 22:12:50 CDT 2016


> On 7 Jul 2016, at 23:28, John McCall via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> On Jul 7, 2016, at 3:26 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>>> On Jul 7, 2016, at 10:58 AM, Vladimir.S via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> I didn't expect this is allowed(with warning):
>>> 
>>> try print("foo")
>>> 
>>> (Swift Ver. 3.0 (Jun 20, 2016))
>>> 
>>> Do we really need to allow 'try' for functions that does not throw exceptions?
>> 
>> This seems like totally fair game for a “warning: ‘try’ specified for expression that does not throw” with a fixit to remove it.  Please file an enhancement request in bugs.swift.org, this isn’t something appropriate for an evolution proposal.
> 
> Agreed.
> 
> John.

<https://bugs.swift.org/browse/SR-2024>

-- Ben



More information about the swift-evolution mailing list