> On 7 Jul 2016, at 19:41, David Sweeris via swift-evolution > <swift-evolution@swift.org> wrote: > > >> On Jul 7, 2016, at 12:58, Vladimir.S via swift-evolution >> <swift-evolution@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? > > What's the harm?
None as such, but you argue that a warning in this case is safer; for example, if you had two similar functions, one of which throws, then typing try on the wrong one will produce a warning that can alert you to the mistake, while the current behaviour never will (in fact the presence of try may make the error harder to spot, as it *looks* correct). So yeah, I'm surprised this is the case, should probably be turned into a warning. _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution