C++ Logo

std-proposals

Advanced search

Re: [std-proposals] MACROS

From: Peter C++ <peter.cpp_at_[hidden]>
Date: Sat, 30 Apr 2022 16:31:52 +0200
beginners shouldn't write loops but call std algorithms. see "Accelerated C++" by Barbara Moo and Andrew Koenig

sent from a mobile device so please excuse strange words due to autocorrection.
Peter Sommerlad
peter.cpp_at_[hidden]
+41-79-432 23 32

> On 30 Apr 2022, at 16:24, William Linkmeyer via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> These keywords wouldn’t necessarily be unwelcome to me. Others may disagree.
>
> However, most importantly, this is not an important feature that *solves a problem*. It has the effect of making certain things for beginners a little bit easier. That’s not a bad addition.
>
> Less importantly, this feature is not and, probably, will never be a concern of a study group because it is not a pressing issue that users are demanding. Networking, performance, and education, for example, are.
>
> WL
>
>> On Apr 30, 2022, at 5:59 AM, Marcin Jaczewski via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> Why not simply use `for (auto x : y)`?
>>
>> ```
>> for (auto i : infinity()) { } //could write to volatile memory to avoid UB
>> for (auto i : std::views::iota(1, 10)) { }
>> for (auto i : unitil([&]{ return true; })) { }
>> for (auto i : rep_until([&]{ return true; })) { }
>> ```
>>
>> sob., 30 kwi 2022 o 07:50 Abdullah Qasim via Std-Proposals
>> <std-proposals_at_[hidden]> napisał(a):
>>>
>>> OK, I take it back.
>>>
>>> It is better implemented as keywords
>>>
>>>
>>>
>>> From: William Linkmeyer via Std-Proposals
>>> Sent: 28 April 2022 22:05
>>> To: std-proposals_at_[hidden]
>>> Cc: William Linkmeyer
>>> Subject: Re: [std-proposals] MACROS
>>>
>>>
>>>
>>> +1 — this would be a highly unusual addition to the standard.
>>>
>>>>>> On Apr 28, 2022, at 12:58 PM, Jason McKesson via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>>>
>>>>> You failed to present any motivation for these changes. Furthermore, I
>>>>> don't know why we would want to add a bunch of macros (which cannot be
>>>>> imported from a module) for such trivial things. Since we got
>>>>> range-based for loops, the number of times I've had to loop over a
>>>>> count is dramatically reduced. And with `ranges::iota` or similar
>>>>> tools, that's now pretty much never. Having a way to spell
>>>>> `while(!expr)` seems pointless; just read the expression.
>>>>>
>>>>> And `rep` is just a bad idea. `while(true)` is an incredibly dangerous
>>>>> thing with a myriad of side-effects (if you don't do certain things in
>>>>> the loop, the forward progress guarantees of the standard allow the
>>>>> compiler to straight-up drop the loop body). It's sufficiently
>>>>> dangerous that we should absolutely not have a short-form version of
>>>>> it.
>>>>> --
>>>>> Std-Proposals mailing list
>>>>> Std-Proposals_at_[hidden]
>>>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>> --
>>> Std-Proposals mailing list
>>> Std-Proposals_at_[hidden]
>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>>
>>>
>>>
>>> --
>>> Std-Proposals mailing list
>>> Std-Proposals_at_[hidden]
>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2022-04-30 14:31:54