Date: Sat, 20 Apr 2024 21:50:57 +0000
I think your question is unfair, so I didn’t answer it.
There are many features in C++ that are rarely used, yet they still exist in the standard. My proposal won’t make any code ill-formed; I’m only concerned with the parts that can be improved by my proposal, namely the 3,800 instances in LLVM and GCC—that’s what’s meaningful. Also, this new syntax could be applied in other common situations, which means if GCC and LLVM adopt it, it won’t be limited to just the 3,800 instances. In Ruby Rails, the usage rate of ‘unless’ is close to 1/5th of ‘if’, which is the upper limit for this syntax’s usage rate.
________________________________
From: Jens Maurer <jens.maurer_at_[hidden]>
Sent: Sunday, April 21, 2024 5:05
To: Yexuan Xiao <bizwen_at_[hidden]>
Cc: std-proposals_at_[hidden] <Std-Proposals_at_[hidden]>
Subject: Re: [std-proposals] if !(condition)
On 20/04/2024 21.34, Yexuan Xiao wrote:
> Thank you for pointing out the error in my proposal; I’ll try to correct it in a later version.
>
> The data from LLVM or GCC shows code that directly benefits from this. Additionally, I searched all the Ruby code in Rails (a Ruby web framework with many users), where ‘unless’ appeared 1808 times, while ‘if’ appeared 10157 times. This data demonstrates the potential of the ‘if not’ pattern.
You're answering a question I didn't ask.
I asked: How many "if" statements are there in LLVM in total?
By my crude count, for all of "llvm-project":
$ find . -name *.h -o -name *.cpp | xargs grep -w '[^#]if' | wc -l
498710
That's far less than 1% of "if" statements that would benefit.
I'm not convinced by those numbers.
> C++23 accepted ‘if !consteval’ instead of ‘if consteval(false)’, and the previous proposal P1181 has revealed other advantages, so I believe adding ‘if !constexpr’ or simply ‘if !’ is not a wart.
You're welcome to disagree with me.
The ISO standardization process is a consensus-driven process,
and I'm herewith advising you, as early in the process as possible,
of my opinion regarding your proposal.
Absent further convincing rationale, I believe your proposal does
not provide sufficient benefits in return for the added complexity,
and I'll vote strongly against your proposal at any opportunity
where I have a chance to do so.
I hope that clarifies my position.
Jens
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* Jens Maurer <jens.maurer_at_[hidden]>
> *Sent:* Sunday, April 21, 2024 3:01
> *To:* std-proposals_at_[hidden] <std-proposals_at_[hidden]>
> *Cc:* Yexuan Xiao <bizwen_at_[hidden]>
> *Subject:* Re: [std-proposals] if !(condition)
>
>
>
> On 20/04/2024 18.09, Yexuan Xiao via Std-Proposals wrote:
>> I've wrote a proposal that suggests allowing the omission of the outermost parentheses to simplify the conditions in if statements:
>> https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstorage.nykz.org%2Fproposals%2Fif-not%2F&data=05%7C02%7C%7C75158e15c0a24f5376c308dc617d9096%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638492439146935584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=q%2FKEdrVYyuwVAaSBVY3u5vbTCVtw2mvW5KLMV935i8M%3D&reserved=0<https://storage.nykz.org/proposals/if-not/> <https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstorage.nykz.org%2Fproposals%2Fif-not%2F&data=05%7C02%7C%7C75158e15c0a24f5376c308dc617d9096%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638492439146943391%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=GDeYh1lCzirmCpYrTNDSbHG9e2tXb9G2%2FRPihC0icmM%3D&reserved=0<https://storage.nykz.org/proposals/if-not/>>
>>
>> Please share your comments.
>
> A "condition" might be a declaration. The "equivalent" syntax
> "!(condition)" is not valid C++ if the "condition" is a declaration.
>
> Thus, your proposal seems incomplete.
>
> You quote 1500 simplification opportunities in LLVM and 2300 ones
> in GCC. How many "if" statements are there in total, in each of
> those codebases?
>
> Beyond that, I'm strongly opposed: this delivers no benefit at all.
> Being able to omit nested parentheses in the condition in some
> cases (but not others, if the negation isn't at the top level)
> is insufficient motivation for another wart in the language,
> in my view.
>
> Someone hiding expression syntax in a macro is just misguided;
> I have no sympathy whatsoever.
>
> Jens
>
There are many features in C++ that are rarely used, yet they still exist in the standard. My proposal won’t make any code ill-formed; I’m only concerned with the parts that can be improved by my proposal, namely the 3,800 instances in LLVM and GCC—that’s what’s meaningful. Also, this new syntax could be applied in other common situations, which means if GCC and LLVM adopt it, it won’t be limited to just the 3,800 instances. In Ruby Rails, the usage rate of ‘unless’ is close to 1/5th of ‘if’, which is the upper limit for this syntax’s usage rate.
________________________________
From: Jens Maurer <jens.maurer_at_[hidden]>
Sent: Sunday, April 21, 2024 5:05
To: Yexuan Xiao <bizwen_at_[hidden]>
Cc: std-proposals_at_[hidden] <Std-Proposals_at_[hidden]>
Subject: Re: [std-proposals] if !(condition)
On 20/04/2024 21.34, Yexuan Xiao wrote:
> Thank you for pointing out the error in my proposal; I’ll try to correct it in a later version.
>
> The data from LLVM or GCC shows code that directly benefits from this. Additionally, I searched all the Ruby code in Rails (a Ruby web framework with many users), where ‘unless’ appeared 1808 times, while ‘if’ appeared 10157 times. This data demonstrates the potential of the ‘if not’ pattern.
You're answering a question I didn't ask.
I asked: How many "if" statements are there in LLVM in total?
By my crude count, for all of "llvm-project":
$ find . -name *.h -o -name *.cpp | xargs grep -w '[^#]if' | wc -l
498710
That's far less than 1% of "if" statements that would benefit.
I'm not convinced by those numbers.
> C++23 accepted ‘if !consteval’ instead of ‘if consteval(false)’, and the previous proposal P1181 has revealed other advantages, so I believe adding ‘if !constexpr’ or simply ‘if !’ is not a wart.
You're welcome to disagree with me.
The ISO standardization process is a consensus-driven process,
and I'm herewith advising you, as early in the process as possible,
of my opinion regarding your proposal.
Absent further convincing rationale, I believe your proposal does
not provide sufficient benefits in return for the added complexity,
and I'll vote strongly against your proposal at any opportunity
where I have a chance to do so.
I hope that clarifies my position.
Jens
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* Jens Maurer <jens.maurer_at_[hidden]>
> *Sent:* Sunday, April 21, 2024 3:01
> *To:* std-proposals_at_[hidden] <std-proposals_at_[hidden]>
> *Cc:* Yexuan Xiao <bizwen_at_[hidden]>
> *Subject:* Re: [std-proposals] if !(condition)
>
>
>
> On 20/04/2024 18.09, Yexuan Xiao via Std-Proposals wrote:
>> I've wrote a proposal that suggests allowing the omission of the outermost parentheses to simplify the conditions in if statements:
>> https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstorage.nykz.org%2Fproposals%2Fif-not%2F&data=05%7C02%7C%7C75158e15c0a24f5376c308dc617d9096%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638492439146935584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=q%2FKEdrVYyuwVAaSBVY3u5vbTCVtw2mvW5KLMV935i8M%3D&reserved=0<https://storage.nykz.org/proposals/if-not/> <https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstorage.nykz.org%2Fproposals%2Fif-not%2F&data=05%7C02%7C%7C75158e15c0a24f5376c308dc617d9096%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638492439146943391%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=GDeYh1lCzirmCpYrTNDSbHG9e2tXb9G2%2FRPihC0icmM%3D&reserved=0<https://storage.nykz.org/proposals/if-not/>>
>>
>> Please share your comments.
>
> A "condition" might be a declaration. The "equivalent" syntax
> "!(condition)" is not valid C++ if the "condition" is a declaration.
>
> Thus, your proposal seems incomplete.
>
> You quote 1500 simplification opportunities in LLVM and 2300 ones
> in GCC. How many "if" statements are there in total, in each of
> those codebases?
>
> Beyond that, I'm strongly opposed: this delivers no benefit at all.
> Being able to omit nested parentheses in the condition in some
> cases (but not others, if the negation isn't at the top level)
> is insufficient motivation for another wart in the language,
> in my view.
>
> Someone hiding expression syntax in a macro is just misguided;
> I have no sympathy whatsoever.
>
> Jens
>
Received on 2024-04-20 21:51:11