August 30, 2016
On Sunday, 28 August 2016 at 16:17:31 UTC, Cauterite wrote:
> I dunno man, it seems all backwards to me. If you're gonna do it this way, then you'd also want your if-statements like this:
>
> {
>     foo();
>     bar();
> } if (cond);
>
> Could you imagine trying to read a function you didn't write yourself if branches were written like that?

Speaking of which, what's up with D's `do{ ... } while(...);`? Why not improve upon the convention and write `dowhile(...){}` or just `do(...){}`, or really anything that doesn't put the condition at the end?
August 30, 2016
On Tue, 30 Aug 2016 11:58:49 +0000, pineapple wrote:

> On Sunday, 28 August 2016 at 16:17:31 UTC, Cauterite wrote:
>> I dunno man, it seems all backwards to me. If you're gonna do it this way, then you'd also want your if-statements like this:
>>
>> {
>>     foo();
>>     bar();
>> } if (cond);
>>
>> Could you imagine trying to read a function you didn't write yourself if branches were written like that?
> 
> Speaking of which, what's up with D's `do{ ... } while(...);`? Why not
> improve upon the convention and write `dowhile(...){}` or just
> `do(...){}`, or really anything that doesn't put the condition at the
> end?

Placing the condition at the end reflects the fact that the condition is executed at the end of the loop.
August 30, 2016
On Tuesday, 30 August 2016 at 07:41:35 UTC, w0rp wrote:
> I don't think this particular syntax is desirable. We already have ternary expressions, and anything more complicated than a regular ternary should probably be written with a regular series of if statements.

The problem is when you're in the middle of a large expression which you don't want to break apart into statements (it might be the body of a '=>' lambda), your options are ternary conditionals (horrid syntax), or something like `{if (x) {return y;} else {return z;};}()` which is just as bad.
August 30, 2016
On Tuesday, 30 August 2016 at 13:38:51 UTC, Chris Wright wrote:
> Placing the condition at the end reflects the fact that the condition is executed at the end of the loop.

I'm aware of that, but the syntax is inconsistent and harder to read.


1 2
Next ›   Last »