February 22, 2022
On 2/22/2022 6:00 PM, forkit wrote:
> On Tuesday, 22 February 2022 at 22:48:59 UTC, Walter Bright wrote:
>> On 2/22/2022 2:05 PM, forkit wrote:
>>> no. sorry. but again, you're confused.
>>
>> Please refrain from calling others confused. It's impolite, and besides, there's always the embarassing risk that the caller is confused, not the callee.
> 
> seriously?

I've lived long enough to know that telling someone they are confused never results in a useful outcome.
February 22, 2022
On 2/22/2022 4:56 PM, Timon Gehr wrote:
> Anyway, it's pretty clear that this won't be in D,
That's right. D's behavior here been universally approved of. I originally thought with the size of this thread that people were going to want to change it, and am glad I was wrong.
February 22, 2022
On 2/22/2022 5:03 PM, Timon Gehr wrote:
> vs:   low <= a[2*i+1] && a[2*i+1] <= high

If the expressions do not have side effects, any half decent compiler will not recompute them.
February 23, 2022
On 23.02.22 05:31, Walter Bright wrote:
> On 2/22/2022 5:03 PM, Timon Gehr wrote:
>> vs:   low <= a[2*i+1] && a[2*i+1] <= high
> 
> If the expressions do not have side effects, any half decent compiler will not recompute them.

Definitely, it's mostly a question of readability for me. But it's not a very big deal. (E.g., syntax for tuple unpacking would be significantly more impactful.)
February 23, 2022
On Wednesday, 23 February 2022 at 04:27:37 UTC, Walter Bright wrote:
>
> ... D's behavior here been universally approved of. I originally thought with the size of this thread that people were going to want to change it, and am glad I was wrong.

That people don't want it in D, is fine. I have no problem with that.

But you assertion is not correct:

https://docs.julialang.org/en/v1/manual/mathematical-operations/#Chaining-comparisons


February 23, 2022
On Wednesday, 23 February 2022 at 08:12:52 UTC, forkit wrote:
> On Wednesday, 23 February 2022 at 04:27:37 UTC, Walter Bright wrote:
>>
>> ... D's behavior here been universally approved of. I originally thought with the size of this thread that people were going to want to change it, and am glad I was wrong.
>
> That people don't want it in D, is fine. I have no problem with that.
>
> But you assertion is not correct:
>
> https://docs.julialang.org/en/v1/manual/mathematical-operations/#Chaining-comparisons

Programming isn't always 1:1 to mathematics.
February 23, 2022
On Wednesday, 23 February 2022 at 08:34:07 UTC, bauss wrote:
> On Wednesday, 23 February 2022 at 08:12:52 UTC, forkit wrote:
>> On Wednesday, 23 February 2022 at 04:27:37 UTC, Walter Bright wrote:
>>>
>>> ... D's behavior here been universally approved of. I originally thought with the size of this thread that people were going to want to change it, and am glad I was wrong.
>>
>> That people don't want it in D, is fine. I have no problem with that.
>>
>> But you assertion is not correct:
>>
>> https://docs.julialang.org/en/v1/manual/mathematical-operations/#Chaining-comparisons
>
> Programming isn't always 1:1 to mathematics.

Nobody has made that argument.

I just like the idea of being able to express:

i < n && n < x

in a mathmatically concise manner:

i < n < x

As with a lot of syntax in programming languages, of course it can be misused, and it also may require mental effort to master.

btw. C is no stranger to the concept of 'conciseness' ;-)

February 23, 2022

On Tuesday, 22 February 2022 at 10:47:48 UTC, Patrick Schluter wrote:

>

On Tuesday, 22 February 2022 at 10:28:56 UTC, forkit wrote:

>

On Tuesday, 22 February 2022 at 09:00:10 UTC, Stanislav Blinov wrote:

>

Call it a habit, although I'd say it's more of an allergy to error-prone practices.

c'mon. all other matters aside...

..you can't deny, that there is beauty in this mess.

1 < 2 < 3 < 4 > 3 == 3

Nope.

I think the stumbling block for a C or D programmer is thinking the comparison operators as binary operators, so that 1 < 2 > 1 must mean op!">"(op!"<"(1, 2), 1) or op!"<"(1, op!">"(2, 1)) or illegal syntax as in D. To understand the Python/Math syntax, you must stop this. In them, the three operands are all handled in one operation: op!("<", ">")(1, 2, 1). There is no right or left associativity.

February 23, 2022
On Wednesday, 23 February 2022 at 04:27:37 UTC, Walter Bright wrote:
>
> ... D's behavior here been universally approved of. I originally thought with the size of this thread that people were going to want to change it, and am glad I was wrong.

a proposal for chaining comparisons in c++

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0893r0.html


February 23, 2022

On Wednesday, 23 February 2022 at 08:56:21 UTC, Dukc wrote:

>

I think the stumbling block for a C or D programmer is thinking the comparison operators as binary operators, so that 1 < 2 > 1 must mean op!">"(op!"<"(1, 2), 1) or op!"<"(1, op!">"(2, 1)) or illegal syntax as in D. To understand the Python/Math syntax, you must stop this. In them, the three operands are all handled in one operation: op!("<", ">")(1, 2, 1). There is no right or left associativity.

This is right. This thread got me reflecting on why python has been so successful in the scientific/engineering/ML domain. I don't think GVR was some extraordinary genius, I think he did a great job of coming up with a dynamic interpreted language that truly was 'turtles all the way down' (use of dicts throughout, metaclasses etc.) and managed the expansion of the language really well. Then numpy and scipy came along (thanks to a number of extremely talented engineers) and python became a very easy way to crunch and analyse numbers. The inherent power of python made it easy to build various package managers. Tkl and then PyQt and wxWidgets made good quality cross-platform GUI apps easy to build, and all along GVR prevented python going off the rails. I also think the 2 -> 3 transition was well timed and a success, contrary to what many bystanders would have you believe.

I would like to see something similar for D (i.e., making it good for e.g. general engineering work) but it hasn't worked out like that. I'm wondering why that is. Is D being wedded to C both its great strength, and its great weakness at the same time?