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

2016-07-08 Thread Mark Dalrymple via swift-evolution
> Xcode creates warning as you type

And the warnings also tend to obscure my typing (rdar://27141386 - warning
box occludes typing when trying to fix a warning).

I turn live issues off (even though that kind of breaks playground error
reporting - rdar://27162167 - playgrounds don't show any errors unless Live
Issues is on) - I know enough of what I'm doing to where I can wait until
the code isn't in an indeterminate state any more and then kick off a build
to error-check.

command-control-M is also a favorite keystroke to hide the in-editor
notices.  You still get them in the gutter.

++md


On Fri, Jul 8, 2016 at 5:00 AM, Tino Heth via swift-evolution <
swift-evolution@swift.org> wrote:

> A try that isn't needed is suspicious… but imho there is a problem with
> warnings, but that isn't primarily caused by Swift itself.
>
> Xcode creates warning as you type, and those often don't help, but just
> distract, as most of them aren't actually dangerous at all:
> - Yes, I'm not using this value yet… but I promise I'll do so five lines
> further down
> - The same with vars that are waiting for their first change
> (those two are the worst for me)
> Things like those don't help me at all, but are rather a distraction — but
> I'm no fan spoon-feeding in general, and would prefer to move most
> Swift-warnings out of the compiler and into a linter.
>
> Tino
> ___
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-07-08 Thread Tino Heth via swift-evolution
A try that isn't needed is suspicious… but imho there is a problem with 
warnings, but that isn't primarily caused by Swift itself.

Xcode creates warning as you type, and those often don't help, but just 
distract, as most of them aren't actually dangerous at all:
- Yes, I'm not using this value yet… but I promise I'll do so five lines 
further down
- The same with vars that are waiting for their first change
(those two are the worst for me)
Things like those don't help me at all, but are rather a distraction — but I'm 
no fan spoon-feeding in general, and would prefer to move most Swift-warnings 
out of the compiler and into a linter.

Tino
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-07-07 Thread Ben Rimmington via swift-evolution

> On 7 Jul 2016, at 23:28, John McCall via swift-evolution 
>  wrote:
> 
>> On Jul 7, 2016, at 3:26 PM, Chris Lattner via swift-evolution 
>>  wrote:
>>> On Jul 7, 2016, at 10:58 AM, Vladimir.S via swift-evolution 
>>>  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.



-- Ben

___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-07-07 Thread John McCall via swift-evolution
> On Jul 7, 2016, at 3:26 PM, Chris Lattner via swift-evolution 
>  wrote:
>> On Jul 7, 2016, at 10:58 AM, Vladimir.S via swift-evolution 
>>  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.

> 
> -Chris
> 
> ___
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-07-07 Thread Chris Lattner via swift-evolution

> On Jul 7, 2016, at 10:58 AM, Vladimir.S via swift-evolution 
>  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.

-Chris

___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-07-07 Thread Haravikk via swift-evolution

> On 7 Jul 2016, at 19:41, David Sweeris via swift-evolution 
>  wrote:
> 
> 
>> On Jul 7, 2016, at 12:58, Vladimir.S via swift-evolution 
>>  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


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

2016-07-07 Thread David Sweeris via swift-evolution

> On Jul 7, 2016, at 12:58, Vladimir.S via swift-evolution 
>  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?

- Dave Sweeris
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-07-07 Thread Vladimir.S via swift-evolution

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?
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution