>
> https://github.com/apple/swift-evolution/blob/master/proposals/0099-conditionclauses.md
> • What is your evaluation of the proposal?
Oof.
I am not a fan of this syntax. `;` reads very strongly as a statement ender to
me, and yet at the same time, it's still visually quite close to `,`. My first
impression was that the proposal had an embarrassing typo in the very first
example.
My suggestion would be to reuse our normal && operator:
guard
x == 0 &&
let y = optional &&
z == 2
else { ... }
This would obviously be a built-in `&&` separate from our existing, infix
operator `&&`. (Well, unless we make `let` and `case` clauses return Bools in
an `if` statement, and somehow teach the compiler that `&&` will return `false`
if a binding fails.) But there is no ambiguity about the meaning of this code.
It is obvious that both conditions have to succeed, and it is obvious that `z
== 2` was not meant to be another optional binding. Honestly, in some ways it's
more understandable than the status quo.
> • Is the problem being addressed significant enough to warrant a change
> to Swift?
Maybe, if we have a good enough solution. I don't think this is it.
> • Does this proposal fit well with the feel and direction of Swift?
I think it's kind of neutral, honestly.
> • If you have used other languages or libraries with a similar feature,
> how do you feel that this proposal compares to those?
Most languages I've used have `if` statements which take a simple boolean
expression, so they don't face this problem.
> • How much effort did you put into your review? A glance, a quick
> reading, or an in-depth study?
Pretty much a glance.
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution