[swift-evolution] [Idea] if let value!

Matthew Johnson matthew at anandabits.com
Tue May 17 11:08:39 CDT 2016


> On May 17, 2016, at 11:06 AM, Vladimir.S <svabox at gmail.com> wrote:
> 
> On 17.05.2016 18:48, Matthew Johnson via swift-evolution wrote:
>> Being syntactic sugar for something that is already not too bad
> 
> Well.. Personally I feel like construction `if let someMyValue = someMyValue` is bad exactly because of this the same repeated name. Anywhere I see repeated code, I feel like this is not good.

I generally agree, but it’s pretty trivial repetition in this case.  And like others have noted, if you need to do this often it might be worth looking at other aspects of how your code is structured.

> 
>> means it
>> would need to be as concise as possible.  If you want to advocate something
>> like this, maybe consider just `if unwrap`:
>> 
>> if unwrap someValue {
>> }
>> 
> 
> Yes, IMO the best idea for this feature for this moment. Clear and explicit. Why not?

If immediate consensus forms, sure why not?  But I don’t think it’s worth extended discussion.


More information about the swift-evolution mailing list