[swift-evolution] for-else syntax
Jeremy Pereira
jeremy.j.pereira at googlemail.com
Fri Feb 3 03:50:10 CST 2017
> On 3 Feb 2017, at 09:27, Dimitri Racordon via swift-evolution <swift-evolution at swift.org> wrote:
>
>> Talking of Python, Swift is not Python and the argument not to implement a feature because its semantics conflict with the semantics of a similar looking feature in another language is bogus. I don’t see the Python for … else being different (and having looked it up to see what you all were talking about, my opinion is that the Python for … else is a disaster) as being a legitimate con to this cleaner and more logical idea in Swift.
>
> Swift is not Python, but Python programmers do program in Swift. Yeah they can look up the documentation and see that the semantics is not the same, but that is definitely error-prone.
I have to say "so what”? You move from one language to another, there are points of confusion. There is no legitimate argument that says Swift should not implement a feature because it would confuse Python programmers (or programmers in any other language). If there were, Swift wouldn’t exist, we would just have a new Python-Coocoa bridge.
>
> While this kind of construct happen quite often, I am not for changing the syntax of a for-loop. To be honest, I don’t think that "for { .. } else { .. }” is so clear intuitive and I think that I would choose most if not all of the other constructions that have been proposed to express the OP’s problem.
That is my position too. There are (persuasive IMO) arguments to say let’s not do this. My rant above was just to say “different to language X and therefore confusing to language X programmers” is not one of them.
More information about the swift-evolution
mailing list