Topic: [std-proposals] Re: Proposal to extend range-based


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 4 Jul 2017 13:33:42 -0700 (PDT)
Raw View
------=_Part_2653_488252739.1499200422996
Content-Type: multipart/alternative;
 boundary="----=_Part_2654_563973965.1499200422996"

------=_Part_2654_563973965.1499200422996
Content-Type: text/plain; charset="UTF-8"



On Tuesday, July 4, 2017 at 2:20:37 PM UTC-4, Abdulla Herzallah wrote:
>
> HI ISO C++ Standard committee,
>
> Apology if I am not following a proper specifications draft, I hope it
> will be reviewed by someone who can help in *evaluating or enhancing*
> this proposal.
>

Here's an even better idea:

for(auto i; std::ints(10))
{
}

Now we don't have to extend anything. We add one standard library function,
and we get everything you need. We can even add a literal to make getting
`size_t`s easier:

for(auto i; std::ints(10z))
{
}

Speaking of literals, we can even have literals that do the entire job, so
we don't need `std::ints` at all:

for(auto i; 10rng)
{
}

In short, there is no good reason to extend the language to do this. We
have plenty of tools to do the job adequately ourselves.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/fd09d6f6-d5c0-4443-b116-5160e12ce13e%40isocpp.org.

------=_Part_2654_563973965.1499200422996
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, July 4, 2017 at 2:20:37 PM UTC-4, Abdu=
lla Herzallah wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">HI ISO C++ Standard committee,<div>=C2=A0=C2=A0<div>Apology if I a=
m not following a proper specifications draft, I hope it will be reviewed b=
y someone who can help in <u>evaluating or enhancing</u> this proposal.</di=
v></div></div></blockquote><div><br>Here&#39;s an even better idea:<br><br>=
<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">for</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> i</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">ints</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify"=
>10</span><span style=3D"color: #660;" class=3D"styled-by-prettify">))</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span></div></code></div><br>Now we do=
n&#39;t have to extend anything. We add one standard library function, and =
we get everything you need. We can even add a literal to make getting `size=
_t`s easier:<br><br><div style=3D"background-color: rgb(250, 250, 250); bor=
der-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; over=
flow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">for</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> i</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">ints</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"s=
tyled-by-prettify">10z</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">))</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></=
div><br>Speaking of literals, we can even have literals that do the entire =
job, so we don&#39;t need `std::ints` at all:<br><br><div style=3D"backgrou=
nd-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-styl=
e: solid; border-width: 1px; overflow-wrap: break-word;" class=3D"prettypri=
nt"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">for</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> i</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">1=
0rng</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></div></code></div><br>In =
short, there is no good reason to extend the language to do this. We have p=
lenty of tools to do the job adequately ourselves.<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fd09d6f6-d5c0-4443-b116-5160e12ce13e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fd09d6f6-d5c0-4443-b116-5160e12ce13e=
%40isocpp.org</a>.<br />

------=_Part_2654_563973965.1499200422996--

------=_Part_2653_488252739.1499200422996--

.


Author: Abdulla Herzallah <abdulla.herzallah@gmail.com>
Date: Wed, 5 Jul 2017 13:36:54 -0700 (PDT)
Raw View
------=_Part_3410_1179350889.1499287015036
Content-Type: multipart/alternative;
 boundary="----=_Part_3411_1023800876.1499287015036"

------=_Part_3411_1023800876.1499287015036
Content-Type: text/plain; charset="UTF-8"

HI Nicol Bolas,
Thanks for your comments.

The idea is to simplify the for-loop where it can be possible, and that
help ensuring faster and readable coding, at the same time there should be
0 impact on performance, which should be possible if adding this extension
to the range-loop.

Adding literals support to range-loop is definitely possible "with relative
ease" to the compiler syntax parser and code generator and generate code
that is exactly as the standard for-loop but much easier to read with such
brevity therefore less prone to errors.  Which was the main reasons for
adding the range-for to the language after all.

The first two cases you presented does not match the idea as it require use
of memory on the stack which is therefore not good idea. While the last
example I am not sure I got you well on it, but it seems is what I am
proposing in a different way, but none the less is still not possible
without adding this feature to the language.

 cheers,
/Abdulla


On Tuesday, July 4, 2017 at 10:33:43 PM UTC+2, Nicol Bolas wrote:
>
>
>
> On Tuesday, July 4, 2017 at 2:20:37 PM UTC-4, Abdulla Herzallah wrote:
>>
>> HI ISO C++ Standard committee,
>>
>> Apology if I am not following a proper specifications draft, I hope it
>> will be reviewed by someone who can help in *evaluating or enhancing*
>> this proposal.
>>
>
> Here's an even better idea:
>
> for(auto i; std::ints(10))
> {
> }
>
> Now we don't have to extend anything. We add one standard library
> function, and we get everything you need. We can even add a literal to make
> getting `size_t`s easier:
>
> for(auto i; std::ints(10z))
> {
> }
>
> Speaking of literals, we can even have literals that do the entire job, so
> we don't need `std::ints` at all:
>
> for(auto i; 10rng)
> {
> }
>
> In short, there is no good reason to extend the language to do this. We
> have plenty of tools to do the job adequately ourselves.
>

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8cc43aaf-130d-4584-befe-8ace140b7b03%40isocpp.org.

------=_Part_3411_1023800876.1499287015036
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">HI Nicol Bolas,=C2=A0<div>Thanks for your comments.</div><=
div><br></div><div>The idea is to simplify the for-loop where it can be pos=
sible, and that help ensuring faster and readable coding, at the same time =
there should be 0 impact on performance, which should be possible if adding=
 this extension to the range-loop.</div><div><br></div><div>Adding literals=
 support to range-loop is definitely possible &quot;with relative ease&quot=
; to the compiler syntax parser and code generator and generate code that i=
s exactly as the standard for-loop but much easier to read with such brevit=
y therefore less prone to errors. =C2=A0Which was the main reasons for addi=
ng the range-for to the language after all.</div><div><br></div><div>The fi=
rst two cases you presented does not match the idea as it require use of me=
mory on the stack which is therefore not good idea. While the last example =
I am not sure I got you well on it, but it seems is what I am proposing in =
a different way, but none the less is still not possible without adding thi=
s feature to the language.<br></div><div><br></div><div>=C2=A0cheers,<br></=
div><div>/Abdulla</div><div><font color=3D"#666600" face=3D"monospace"><br>=
</font><br>On Tuesday, July 4, 2017 at 10:33:43 PM UTC+2, Nicol Bolas wrote=
:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bo=
rder-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><br>On T=
uesday, July 4, 2017 at 2:20:37 PM UTC-4, Abdulla Herzallah wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">HI ISO C++ Standard committ=
ee,<div>=C2=A0=C2=A0<div>Apology if I am not following a proper specificati=
ons draft, I hope it will be reviewed by someone who can help in <u>evaluat=
ing or enhancing</u> this proposal.</div></div></div></blockquote><div><br>=
Here&#39;s an even better idea:<br><br><div style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px"><code><div><span style=3D"color:#008">for</span><span style=3D"color:#6=
60">(</span><span style=3D"color:#008">auto</span><span style=3D"color:#000=
"> i</span><span style=3D"color:#660">;</span><span style=3D"color:#000"> s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">int=
s</span><span style=3D"color:#660">(</span><span style=3D"color:#066">10</s=
pan><span style=3D"color:#660">))</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#660">{</span><span style=3D"color:#000"><br></span=
><span style=3D"color:#660">}</span><span style=3D"color:#000"><br></span><=
/div></code></div><br>Now we don&#39;t have to extend anything. We add one =
standard library function, and we get everything you need. We can even add =
a literal to make getting `size_t`s easier:<br><br><div style=3D"background=
-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bo=
rder-width:1px"><code><div><span style=3D"color:#008">for</span><span style=
=3D"color:#660">(</span><span style=3D"color:#008">auto</span><span style=
=3D"color:#000"> i</span><span style=3D"color:#660">;</span><span style=3D"=
color:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"c=
olor:#000">ints</span><span style=3D"color:#660">(</span><span style=3D"col=
or:#066">10z</span><span style=3D"color:#660">))</span><span style=3D"color=
:#000"><br></span><span style=3D"color:#660">{</span><span style=3D"color:#=
000"><br></span><span style=3D"color:#660">}</span><span style=3D"color:#00=
0"><br></span></div></code></div><br>Speaking of literals, we can even have=
 literals that do the entire job, so we don&#39;t need `std::ints` at all:<=
br><br><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187=
,187,187);border-style:solid;border-width:1px"><code><div><span style=3D"co=
lor:#008">for</span><span style=3D"color:#660">(</span><span style=3D"color=
:#008">auto</span><span style=3D"color:#000"> i</span><span style=3D"color:=
#660">;</span><span style=3D"color:#000"> </span><span style=3D"color:#066"=
>10rng</span><span style=3D"color:#660">)</span><span style=3D"color:#000">=
<br></span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r></span><span style=3D"color:#660">}</span></div></code></div><br>In short=
, there is no good reason to extend the language to do this. We have plenty=
 of tools to do the job adequately ourselves.<br></div></div></blockquote><=
/div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8cc43aaf-130d-4584-befe-8ace140b7b03%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8cc43aaf-130d-4584-befe-8ace140b7b03=
%40isocpp.org</a>.<br />

------=_Part_3411_1023800876.1499287015036--

------=_Part_3410_1179350889.1499287015036--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 5 Jul 2017 15:10:25 -0700 (PDT)
Raw View
------=_Part_3646_1620859210.1499292625831
Content-Type: multipart/alternative;
 boundary="----=_Part_3647_707179951.1499292625831"

------=_Part_3647_707179951.1499292625831
Content-Type: text/plain; charset="UTF-8"

On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:
>
> HI Nicol Bolas,
> Thanks for your comments.
>
> The idea is to simplify the for-loop where it can be possible, and that
> help ensuring faster and readable coding, at the same time there should be
> 0 impact on performance, which should be possible if adding this extension
> to the range-loop.
>
> Adding literals support to range-loop is definitely possible "with
> relative ease" to the compiler syntax parser and code generator and
> generate code that is exactly as the standard for-loop but much easier to
> read with such brevity therefore less prone to errors. Which was the main
> reasons for adding the range-for to the language after all.
>

The difference is this: even with a range-ified `std::for_each`, you could
not get the exact equivalent of range-based `for`, due to having to pass a
functor. What you lose (among other things) is the ability to use `break`
to terminate the loop early. S a library solution would always be inferior
to the language solution.

This is not true of what you're talking about. What I suggested can get
100% of the desired behavior. As such, there is no *need* to have a
language solution, since we can get the same thing through the library.

Not only that, we can do so much better with a library-based solution:

for(auto i: 20rng) {} //Counts on the range [0, 20)
for(auto i: 20revrng) {} //Counts on the range (20, 0]
for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in increments
of 2

Your solution is only useful for counting from 0. Oh sure, you can augment
it to add more counting types and so forth. But that just makes it a more
complex feature.

The first two cases you presented does not match the idea as it require use
> of memory on the stack which is therefore not good idea.
>

That's a matter for the optimizer to deal with.

While the last example I am not sure I got you well on it, but it seems is
> what I am proposing in a different way, but none the less is still not
> possible without adding this feature to the language.
>

No, I was talking about having a standard library user-defined literal
<http://en.cppreference.com/w/cpp/language/user_literal>. `10rng` would,
through a UDL function, invoke `std::ints(10)`. Nothing in the language
needs to be changed to make that happen.

I used that as an example of the brevity that you can have even with a pure
standard library solution.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/181cebac-dd99-477e-adac-823d1a2253f4%40isocpp.org.

------=_Part_3647_707179951.1499292625831
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla He=
rzallah wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
>HI Nicol Bolas,=C2=A0<div>Thanks for your comments.</div><div><br></div><d=
iv>The idea is to simplify the for-loop where it can be possible, and that =
help ensuring faster and readable coding, at the same time there should be =
0 impact on performance, which should be possible if adding this extension =
to the range-loop.</div><div><br></div><div>Adding literals support to rang=
e-loop is definitely possible &quot;with relative ease&quot; to the compile=
r syntax parser and code generator and generate code that is exactly as the=
 standard for-loop but much easier to read with such brevity therefore less=
 prone to errors. Which was the main reasons for adding the range-for to th=
e language after all.</div></div></blockquote><div><br>The difference is th=
is: even with a range-ified `std::for_each`, you could not get the exact eq=
uivalent of range-based `for`, due to having to pass a functor. What you lo=
se (among other things) is the ability to use `break` to terminate the loop=
 early. S a library solution would always be inferior to the language solut=
ion.<br><br>This is not true of what you&#39;re talking about. What I sugge=
sted can get 100% of the desired behavior. As such, there is no <i>need</i>=
 to have a language solution, since we can get the same thing through the l=
ibrary.<br><br>Not only that, we can do so much better with a library-based=
 solution:<br><br><div style=3D"background-color: rgb(250, 250, 250); borde=
r-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overfl=
ow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">for</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> i</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">20rng</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{}</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
Counts on the range [0, 20)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">for</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> i</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">20revrng</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{}</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//Counts on the range (20, 0]</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">for</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">au=
to</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> i</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #066;" class=3D"styled-by-prettify">4begin</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">|</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-=
prettify">43end</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">{}</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//Counts on the range [4, 43=
)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">for</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> i</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-b=
y-prettify">16begin</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
|</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #066;" class=3D"styled-by-prettify">12end</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">{}</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">//Counts on the range (16, 12]</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">for</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> i</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #066;" class=3D"styled-by-prettify">20rng</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">|</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" cla=
ss=3D"styled-by-prettify">2step</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">//Counts on th=
e range [0, 20), in increments of 2</span></div></code></div><br>Your solut=
ion is only useful for counting from 0. Oh sure, you can augment it to add =
more counting types and so forth. But that just makes it a more complex fea=
ture.<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><div>The first two cases you presented does not match the idea as it =
require use of memory on the stack which is therefore not good idea.</div><=
/div></blockquote><div><br>That&#39;s a matter for the optimizer to deal wi=
th.<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div>While the last example I am not sure I got you well on it, but it =
seems is what I am proposing in a different way, but none the less is still=
 not possible without adding this feature to the language.<br></div></div><=
/blockquote><div><br>No, I was talking about having a standard library <a h=
ref=3D"http://en.cppreference.com/w/cpp/language/user_literal">user-defined=
 literal</a>. `10rng` would, through a UDL function, invoke `std::ints(10)`=
.. Nothing in the language needs to be changed to make that happen.<br><br>I=
 used that as an example of the brevity that you can have even with a pure =
standard library solution.</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/181cebac-dd99-477e-adac-823d1a2253f4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/181cebac-dd99-477e-adac-823d1a2253f4=
%40isocpp.org</a>.<br />

------=_Part_3647_707179951.1499292625831--

------=_Part_3646_1620859210.1499292625831--

.


Author: gmisocpp@gmail.com
Date: Wed, 5 Jul 2017 15:27:44 -0700 (PDT)
Raw View
------=_Part_3420_419601314.1499293664787
Content-Type: multipart/alternative;
 boundary="----=_Part_3421_2018849127.1499293664788"

------=_Part_3421_2018849127.1499293664788
Content-Type: text/plain; charset="UTF-8"



On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:
>
> On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:
>>
>> HI Nicol Bolas,
>> Thanks for your comments.
>>
>> The idea is to simplify the for-loop where it can be possible, and that
>> help ensuring faster and readable coding, at the same time there should be
>> 0 impact on performance, which should be possible if adding this extension
>> to the range-loop.
>>
>> Adding literals support to range-loop is definitely possible "with
>> relative ease" to the compiler syntax parser and code generator and
>> generate code that is exactly as the standard for-loop but much easier to
>> read with such brevity therefore less prone to errors. Which was the main
>> reasons for adding the range-for to the language after all.
>>
>
> The difference is this: even with a range-ified `std::for_each`, you could
> not get the exact equivalent of range-based `for`, due to having to pass a
> functor. What you lose (among other things) is the ability to use `break`
> to terminate the loop early. S a library solution would always be inferior
> to the language solution.
>
> This is not true of what you're talking about. What I suggested can get
> 100% of the desired behavior. As such, there is no *need* to have a
> language solution, since we can get the same thing through the library.
>
> Not only that, we can do so much better with a library-based solution:
>
> for(auto i: 20rng) {} //Counts on the range [0, 20)
> for(auto i: 20revrng) {} //Counts on the range (20, 0]
> for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
> for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
> for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in
> increments of 2
>
> Your solution is only useful for counting from 0. Oh sure, you can augment
> it to add more counting types and so forth. But that just makes it a more
> complex feature.
>
> The first two cases you presented does not match the idea as it require
>> use of memory on the stack which is therefore not good idea.
>>
>
> That's a matter for the optimizer to deal with.
>
> While the last example I am not sure I got you well on it, but it seems is
>> what I am proposing in a different way, but none the less is still not
>> possible without adding this feature to the language.
>>
>
> No, I was talking about having a standard library user-defined literal
> <http://en.cppreference.com/w/cpp/language/user_literal>. `10rng` would,
> through a UDL function, invoke `std::ints(10)`. Nothing in the language
> needs to be changed to make that happen.
>
> I used that as an example of the brevity that you can have even with a
> pure standard library solution.
>

Really, you us to write this?

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/58d87756-f321-4fa4-a2d3-8f694599ed08%40isocpp.org.

------=_Part_3421_2018849127.1499293664788
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, N=
icol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); borde=
r-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr">On Wednesday=
, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:<blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; b=
order-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-s=
tyle: solid;"><div dir=3D"ltr">HI Nicol Bolas,=C2=A0<div>Thanks for your co=
mments.</div><div><br></div><div>The idea is to simplify the for-loop where=
 it can be possible, and that help ensuring faster and readable coding, at =
the same time there should be 0 impact on performance, which should be poss=
ible if adding this extension to the range-loop.</div><div><br></div><div>A=
dding literals support to range-loop is definitely possible &quot;with rela=
tive ease&quot; to the compiler syntax parser and code generator and genera=
te code that is exactly as the standard for-loop but much easier to read wi=
th such brevity therefore less prone to errors. Which was the main reasons =
for adding the range-for to the language after all.</div></div></blockquote=
><div><br>The difference is this: even with a range-ified `std::for_each`, =
you could not get the exact equivalent of range-based `for`, due to having =
to pass a functor. What you lose (among other things) is the ability to use=
 `break` to terminate the loop early. S a library solution would always be =
inferior to the language solution.<br><br>This is not true of what you&#39;=
re talking about. What I suggested can get 100% of the desired behavior. As=
 such, there is no <i>need</i> to have a language solution, since we can ge=
t the same thing through the library.<br><br>Not only that, we can do so mu=
ch better with a library-based solution:<br><br><div style=3D"border: 1px s=
olid rgb(187, 187, 187); border-image: none; background-color: rgb(250, 250=
, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);">for</span><span =
style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, =
136);">auto</span><span style=3D"color: rgb(0, 0, 0);"> i</span><span style=
=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(0, 102, 102);">20rng</span><span style=3D=
"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </=
span><span style=3D"color: rgb(102, 102, 0);">{}</span><span style=3D"color=
: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">//Counts on=
 the range [0, 20)</span><span style=3D"color: rgb(0, 0, 0);"><br></span><s=
pan style=3D"color: rgb(0, 0, 136);">for</span><span style=3D"color: rgb(10=
2, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">auto</span><spa=
n style=3D"color: rgb(0, 0, 0);"> i</span><span style=3D"color: rgb(102, 10=
2, 0);">:</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D=
"color: rgb(0, 102, 102);">20revrng</span><span style=3D"color: rgb(102, 10=
2, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D=
"color: rgb(102, 102, 0);">{}</span><span style=3D"color: rgb(0, 0, 0);"> <=
/span><span style=3D"color: rgb(136, 0, 0);">//Counts on the range (20, 0]<=
/span><span style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color:=
 rgb(0, 0, 136);">for</span><span style=3D"color: rgb(102, 102, 0);">(</spa=
n><span style=3D"color: rgb(0, 0, 136);">auto</span><span style=3D"color: r=
gb(0, 0, 0);"> i</span><span style=3D"color: rgb(102, 102, 0);">:</span><sp=
an style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102,=
 102);">4begin</span><span style=3D"color: rgb(0, 0, 0);"> </span><span sty=
le=3D"color: rgb(102, 102, 0);">|</span><span style=3D"color: rgb(0, 0, 0);=
"> </span><span style=3D"color: rgb(0, 102, 102);">43end</span><span style=
=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(102, 102, 0);">{}</span><span style=3D"co=
lor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">//Counts=
 on the range [4, 43)</span><span style=3D"color: rgb(0, 0, 0);"><br></span=
><span style=3D"color: rgb(0, 0, 136);">for</span><span style=3D"color: rgb=
(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">auto</span><=
span style=3D"color: rgb(0, 0, 0);"> i</span><span style=3D"color: rgb(102,=
 102, 0);">:</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 102, 102);">16begin</span><span style=3D"color: rgb(0, 0,=
 0);"> </span><span style=3D"color: rgb(102, 102, 0);">|</span><span style=
=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">=
12end</span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D=
"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">{}<=
/span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rg=
b(136, 0, 0);">//Counts on the range (16, 12]</span><span style=3D"color: r=
gb(0, 0, 0);"><br></span><span style=3D"color: rgb(0, 0, 136);">for</span><=
span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0=
, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);"> i</span><span =
style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color: rgb(0, 0, =
0);"> </span><span style=3D"color: rgb(0, 102, 102);">20rng</span><span sty=
le=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);=
">|</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color=
: rgb(0, 102, 102);">2step</span><span style=3D"color: rgb(102, 102, 0);">)=
</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: r=
gb(102, 102, 0);">{}</span><span style=3D"color: rgb(0, 0, 0);"> </span><sp=
an style=3D"color: rgb(136, 0, 0);">//Counts on the range [0, 20), in incre=
ments of 2</span></div></code></div><br>Your solution is only useful for co=
unting from 0. Oh sure, you can augment it to add more counting types and s=
o forth. But that just makes it a more complex feature.<br><br></div><block=
quote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-lef=
t: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; bord=
er-left-style: solid;"><div dir=3D"ltr"><div>The first two cases you presen=
ted does not match the idea as it require use of memory on the stack which =
is therefore not good idea.</div></div></blockquote><div><br>That&#39;s a m=
atter for the optimizer to deal with.<br><br></div><blockquote class=3D"gma=
il_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-lef=
t-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: sol=
id;"><div dir=3D"ltr"><div>While the last example I am not sure I got you w=
ell on it, but it seems is what I am proposing in a different way, but none=
 the less is still not possible without adding this feature to the language=
..<br></div></div></blockquote><div><br>No, I was talking about having a sta=
ndard library <a onmousedown=3D"this.href=3D&#39;http://www.google.com/url?=
q\x3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2Fuser_literal\x=
26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlaPV38-lRIbwVOscppez7q1Kx4g&#39;;re=
turn true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2Fuser_literal\x26sa\x3dD=
\x26sntz\x3d1\x26usg\x3dAFQjCNHlaPV38-lRIbwVOscppez7q1Kx4g&#39;;return true=
;" href=3D"http://en.cppreference.com/w/cpp/language/user_literal" target=
=3D"_blank" rel=3D"nofollow">user-defined literal</a>. `10rng` would, throu=
gh a UDL function, invoke `std::ints(10)`. Nothing in the language needs to=
 be changed to make that happen.<br><br>I used that as an example of the br=
evity that you can have even with a pure standard library solution.</div></=
div></blockquote><div><br></div><div>Really, you us to write this?=C2=A0</d=
iv></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/58d87756-f321-4fa4-a2d3-8f694599ed08%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/58d87756-f321-4fa4-a2d3-8f694599ed08=
%40isocpp.org</a>.<br />

------=_Part_3421_2018849127.1499293664788--

------=_Part_3420_419601314.1499293664787--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 5 Jul 2017 15:41:21 -0700 (PDT)
Raw View
------=_Part_230_445535826.1499294481124
Content-Type: multipart/alternative;
 boundary="----=_Part_231_629319472.1499294481124"

------=_Part_231_629319472.1499294481124
Content-Type: text/plain; charset="UTF-8"

On Wednesday, July 5, 2017 at 6:27:44 PM UTC-4, gmis...@gmail.com wrote:
>
> On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:
>>
>> On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:
>>>
>>> HI Nicol Bolas,
>>> Thanks for your comments.
>>>
>>> The idea is to simplify the for-loop where it can be possible, and that
>>> help ensuring faster and readable coding, at the same time there should be
>>> 0 impact on performance, which should be possible if adding this extension
>>> to the range-loop.
>>>
>>> Adding literals support to range-loop is definitely possible "with
>>> relative ease" to the compiler syntax parser and code generator and
>>> generate code that is exactly as the standard for-loop but much easier to
>>> read with such brevity therefore less prone to errors. Which was the main
>>> reasons for adding the range-for to the language after all.
>>>
>>
>> The difference is this: even with a range-ified `std::for_each`, you
>> could not get the exact equivalent of range-based `for`, due to having to
>> pass a functor. What you lose (among other things) is the ability to use
>> `break` to terminate the loop early. S a library solution would always be
>> inferior to the language solution.
>>
>> This is not true of what you're talking about. What I suggested can get
>> 100% of the desired behavior. As such, there is no *need* to have a
>> language solution, since we can get the same thing through the library.
>>
>> Not only that, we can do so much better with a library-based solution:
>>
>> for(auto i: 20rng) {} //Counts on the range [0, 20)
>> for(auto i: 20revrng) {} //Counts on the range (20, 0]
>> for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
>> for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
>> for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in
>> increments of 2
>>
>> Your solution is only useful for counting from 0. Oh sure, you can
>> augment it to add more counting types and so forth. But that just makes it
>> a more complex feature.
>>
>> The first two cases you presented does not match the idea as it require
>>> use of memory on the stack which is therefore not good idea.
>>>
>>
>> That's a matter for the optimizer to deal with.
>>
>> While the last example I am not sure I got you well on it, but it seems
>>> is what I am proposing in a different way, but none the less is still not
>>> possible without adding this feature to the language.
>>>
>>
>> No, I was talking about having a standard library user-defined literal
>> <http://en.cppreference.com/w/cpp/language/user_literal>. `10rng` would,
>> through a UDL function, invoke `std::ints(10)`. Nothing in the language
>> needs to be changed to make that happen.
>>
>> I used that as an example of the brevity that you can have even with a
>> pure standard library solution.
>>
>
> Really, you us to write this?
>

I'm sorry, I don't understand what you were trying to say. If you're saying
that we shouldn't have something like `10rng` as shorthand for "an integer
range from 0 to 10", what's wrong with that?

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c8c4a3e3-fdb5-4bf1-b62f-ae32a6c3882e%40isocpp.org.

------=_Part_231_629319472.1499294481124
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, July 5, 2017 at 6:27:44 PM UTC-4, gmis...@gm=
ail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
>On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1=
ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-sty=
le:solid"><div dir=3D"ltr">On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, =
Abdulla Herzallah wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border=
-left-width:1px;border-left-style:solid"><div dir=3D"ltr">HI Nicol Bolas,=
=C2=A0<div>Thanks for your comments.</div><div><br></div><div>The idea is t=
o simplify the for-loop where it can be possible, and that help ensuring fa=
ster and readable coding, at the same time there should be 0 impact on perf=
ormance, which should be possible if adding this extension to the range-loo=
p.</div><div><br></div><div>Adding literals support to range-loop is defini=
tely possible &quot;with relative ease&quot; to the compiler syntax parser =
and code generator and generate code that is exactly as the standard for-lo=
op but much easier to read with such brevity therefore less prone to errors=
.. Which was the main reasons for adding the range-for to the language after=
 all.</div></div></blockquote><div><br>The difference is this: even with a =
range-ified `std::for_each`, you could not get the exact equivalent of rang=
e-based `for`, due to having to pass a functor. What you lose (among other =
things) is the ability to use `break` to terminate the loop early. S a libr=
ary solution would always be inferior to the language solution.<br><br>This=
 is not true of what you&#39;re talking about. What I suggested can get 100=
% of the desired behavior. As such, there is no <i>need</i> to have a langu=
age solution, since we can get the same thing through the library.<br><br>N=
ot only that, we can do so much better with a library-based solution:<br><b=
r><div style=3D"border:1px solid rgb(187,187,187);background-color:rgb(250,=
250,250)"><code><div><span style=3D"color:rgb(0,0,136)">for</span><span sty=
le=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)">auto=
</span><span style=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(1=
02,102,0)">:</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"=
color:rgb(0,102,102)">20rng</span><span style=3D"color:rgb(102,102,0)">)</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,1=
02,0)">{}</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"col=
or:rgb(136,0,0)">//Counts on the range [0, 20)</span><span style=3D"color:r=
gb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)">for</span><span st=
yle=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)">aut=
o</span><span style=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(=
102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D=
"color:rgb(0,102,102)">20revrng</span><span style=3D"color:rgb(102,102,0)">=
)</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(1=
02,102,0)">{}</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D=
"color:rgb(136,0,0)">//Counts on the range (20, 0]</span><span style=3D"col=
or:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)">for</span><spa=
n style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)"=
>auto</span><span style=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:=
rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(0,102,102)">4begin</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(102,102,0)">|</span><span style=3D"color:rgb=
(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">43end</span><span sty=
le=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0,=
0,0)"> </span><span style=3D"color:rgb(136,0,0)">//Counts on the range [4, =
43)</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:=
rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(</span><span =
style=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i=
</span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">16begin</span><span =
style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">|</=
span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,10=
2,102)">12end</span><span style=3D"color:rgb(102,102,0)">)</span><span styl=
e=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0=
)">//Counts on the range (16, 12]</span><span style=3D"color:rgb(0,0,0)"><b=
r></span><span style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:=
rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)">auto</span><span=
 style=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(102,102,0)">:=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,=
102,102)">20rng</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(102,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(0,102,102)">2step</span><span style=3D"color:rgb(1=
02,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"=
color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0,0,0)"> </span><sp=
an style=3D"color:rgb(136,0,0)">//Counts on the range [0, 20), in increment=
s of 2</span></div></code></div><br>Your solution is only useful for counti=
ng from 0. Oh sure, you can augment it to add more counting types and so fo=
rth. But that just makes it a more complex feature.<br><br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;=
border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:=
solid"><div dir=3D"ltr"><div>The first two cases you presented does not mat=
ch the idea as it require use of memory on the stack which is therefore not=
 good idea.</div></div></blockquote><div><br>That&#39;s a matter for the op=
timizer to deal with.<br><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204=
,204);border-left-width:1px;border-left-style:solid"><div dir=3D"ltr"><div>=
While the last example I am not sure I got you well on it, but it seems is =
what I am proposing in a different way, but none the less is still not poss=
ible without adding this feature to the language.<br></div></div></blockquo=
te><div><br>No, I was talking about having a standard library <a href=3D"ht=
tp://en.cppreference.com/w/cpp/language/user_literal" rel=3D"nofollow" targ=
et=3D"_blank" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x=
3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2Fuser_literal\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlaPV38-lRIbwVOscppez7q1Kx4g&#39;;retur=
n true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A=
%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2Fuser_literal\x26sa\x3dD\x2=
6sntz\x3d1\x26usg\x3dAFQjCNHlaPV38-lRIbwVOscppez7q1Kx4g&#39;;return true;">=
user-defined literal</a>. `10rng` would, through a UDL function, invoke `st=
d::ints(10)`. Nothing in the language needs to be changed to make that happ=
en.<br><br>I used that as an example of the brevity that you can have even =
with a pure standard library solution.</div></div></blockquote><div><br></d=
iv><div>Really, you us to write this?</div></div></blockquote><div><br>I&#3=
9;m sorry, I don&#39;t understand what you were trying to say. If you&#39;r=
e saying that we shouldn&#39;t have something like `10rng` as shorthand for=
 &quot;an integer range from 0 to 10&quot;, what&#39;s wrong with that?<br>=
</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c8c4a3e3-fdb5-4bf1-b62f-ae32a6c3882e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c8c4a3e3-fdb5-4bf1-b62f-ae32a6c3882e=
%40isocpp.org</a>.<br />

------=_Part_231_629319472.1499294481124--

------=_Part_230_445535826.1499294481124--

.


Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Wed, 5 Jul 2017 16:08:01 -0700 (PDT)
Raw View
------=_Part_3575_389590199.1499296081219
Content-Type: multipart/alternative;
 boundary="----=_Part_3576_1353735132.1499296081219"

------=_Part_3576_1353735132.1499296081219
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bolas wrote:
>
> On Wednesday, July 5, 2017 at 6:27:44 PM UTC-4, gmis...@gmail.com wrote:
>>
>> On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:
>>>
>>> On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote=
:
>>>>
>>>> HI Nicol Bolas,=20
>>>> Thanks for your comments.
>>>>
>>>> The idea is to simplify the for-loop where it can be possible, and tha=
t=20
>>>> help ensuring faster and readable coding, at the same time there shoul=
d be=20
>>>> 0 impact on performance, which should be possible if adding this exten=
sion=20
>>>> to the range-loop.
>>>>
>>>> Adding literals support to range-loop is definitely possible "with=20
>>>> relative ease" to the compiler syntax parser and code generator and=20
>>>> generate code that is exactly as the standard for-loop but much easier=
 to=20
>>>> read with such brevity therefore less prone to errors. Which was the m=
ain=20
>>>> reasons for adding the range-for to the language after all.
>>>>
>>>
>>> The difference is this: even with a range-ified `std::for_each`, you=20
>>> could not get the exact equivalent of range-based `for`, due to having =
to=20
>>> pass a functor. What you lose (among other things) is the ability to us=
e=20
>>> `break` to terminate the loop early. S a library solution would always =
be=20
>>> inferior to the language solution.
>>>
>>> This is not true of what you're talking about. What I suggested can get=
=20
>>> 100% of the desired behavior. As such, there is no *need* to have a=20
>>> language solution, since we can get the same thing through the library.
>>>
>>> Not only that, we can do so much better with a library-based solution:
>>>
>>> for(auto i: 20rng) {} //Counts on the range [0, 20)
>>> for(auto i: 20revrng) {} //Counts on the range (20, 0]
>>> for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
>>> for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
>>> for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in=20
>>> increments of 2
>>>
>>
>> Really, you [ask] us to write this?
>>
>
> I'm sorry, I don't understand what you were trying to say. If you're=20
> saying that we shouldn't have something like `10rng` as shorthand for "an=
=20
> integer range from 0 to 10", what's wrong with that?
>

Well, "rng" is an abbreviation for "random number generator", for one. ;)
But I don't think Nicol is [or needs to be] arguing that we should=20
*standardize* the UDL suffixes "rng" or "begin" or "end" or "step" or=20
"revrng". The core point here seems to be [or should be] that Abdulla could=
=20
go home right now and write those UDLs *himself*, and then he wouldn't=20
desire a core language change anymore, because he'd have something just as=
=20
useful and in fact infinitely more expressive and flexible, and also he=20
could use it in C++11 today instead of only in C++20 tomorrow.

Zhihao's reply shows that anyone suitably familiar with C++ can take=20
Nicol's verbal description of "10rng" and turn it into working, zero-cost=
=20
C++ code. I notice that Zhihao implemented the much more conservative=20
syntax xrange(10), presumably by analogy with Python. I like this. :)

=E2=80=93Arthur

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/7909e1f5-68b4-4e73-a7ef-f73e9181bff6%40isocpp.or=
g.

------=_Part_3576_1353735132.1499296081219
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bola=
s wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On We=
dnesday, July 5, 2017 at 6:27:44 PM UTC-4, <a>gmis...@gmail.com</a> wrote:<=
blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border=
-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Thursday, July 6=
, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:<blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color=
:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div dir=
=3D"ltr">On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah =
wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;p=
adding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;bo=
rder-left-style:solid"><div dir=3D"ltr">HI Nicol Bolas,=C2=A0<div>Thanks fo=
r your comments.</div><div><br></div><div>The idea is to simplify the for-l=
oop where it can be possible, and that help ensuring faster and readable co=
ding, at the same time there should be 0 impact on performance, which shoul=
d be possible if adding this extension to the range-loop.</div><div><br></d=
iv><div>Adding literals support to range-loop is definitely possible &quot;=
with relative ease&quot; to the compiler syntax parser and code generator a=
nd generate code that is exactly as the standard for-loop but much easier t=
o read with such brevity therefore less prone to errors. Which was the main=
 reasons for adding the range-for to the language after all.</div></div></b=
lockquote><div><br>The difference is this: even with a range-ified `std::fo=
r_each`, you could not get the exact equivalent of range-based `for`, due t=
o having to pass a functor. What you lose (among other things) is the abili=
ty to use `break` to terminate the loop early. S a library solution would a=
lways be inferior to the language solution.<br><br>This is not true of what=
 you&#39;re talking about. What I suggested can get 100% of the desired beh=
avior. As such, there is no <i>need</i> to have a language solution, since =
we can get the same thing through the library.<br><br>Not only that, we can=
 do so much better with a library-based solution:<br><br><div style=3D"bord=
er:1px solid rgb(187,187,187);background-color:rgb(250,250,250)"><code><div=
><span style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,=
102,0)">(</span><span style=3D"color:rgb(0,0,136)">auto</span><span style=
=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(102,102,0)">:</span=
><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,10=
2)">20rng</span><span style=3D"color:rgb(102,102,0)">)</span><span style=3D=
"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}</span><s=
pan style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">/=
/Counts on the range [0, 20)</span><span style=3D"color:rgb(0,0,0)"><br></s=
pan><span style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(1=
02,102,0)">(</span><span style=3D"color:rgb(0,0,136)">auto</span><span styl=
e=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(102,102,0)">:</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,1=
02)">20revrng</span><span style=3D"color:rgb(102,102,0)">)</span><span styl=
e=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0=
)">//Counts on the range (20, 0]</span><span style=3D"color:rgb(0,0,0)"><br=
></span><span style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:r=
gb(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)">auto</span><span =
style=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(102,102,0)">:<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,1=
02,102)">4begin</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(102,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(0,102,102)">43end</span><span style=3D"color:rgb(1=
02,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"=
color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0,0,0)"> </span><sp=
an style=3D"color:rgb(136,0,0)">//Counts on the range [4, 43)</span><span s=
tyle=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)">for=
</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rg=
b(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i</span><span styl=
e=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(0,102,102)">16begin</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">|</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">12end</s=
pan><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0=
,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}</span><span style=3D=
"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">//Counts on t=
he range (16, 12]</span><span style=3D"color:rgb(0,0,0)"><br></span><span s=
tyle=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">=
(</span><span style=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:=
rgb(0,0,0)"> i</span><span style=3D"color:rgb(102,102,0)">:</span><span sty=
le=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">20rng<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102=
,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"co=
lor:rgb(0,102,102)">2step</span><span style=3D"color:rgb(102,102,0)">)</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102=
,0)">{}</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color=
:rgb(136,0,0)">//Counts on the range [0, 20), in increments of 2</span></di=
v></code></div></div></div></blockquote><div><br></div><div>Really, you [as=
k] us to write this?</div></div></blockquote><div><br>I&#39;m sorry, I don&=
#39;t understand what you were trying to say. If you&#39;re saying that we =
shouldn&#39;t have something like `10rng` as shorthand for &quot;an integer=
 range from 0 to 10&quot;, what&#39;s wrong with that?<br></div></div></blo=
ckquote><div><br></div><div>Well, &quot;rng&quot; is an abbreviation for &q=
uot;random number generator&quot;, for one. ;)</div><div>But I don&#39;t th=
ink Nicol is [or needs to be] arguing that we should <i>standardize</i> the=
 UDL suffixes &quot;rng&quot; or &quot;begin&quot; or &quot;end&quot; or &q=
uot;step&quot; or &quot;revrng&quot;. The core point here seems to be [or s=
hould be] that Abdulla could go home right now and write those UDLs <i>hims=
elf</i>, and then he wouldn&#39;t desire a core language change anymore, be=
cause he&#39;d have something just as useful and in fact infinitely more ex=
pressive and flexible, and also he could use it in C++11 today instead of o=
nly in C++20 tomorrow.<br></div><div><br></div><div>Zhihao&#39;s reply show=
s that anyone suitably familiar with C++ can take Nicol&#39;s verbal descri=
ption of &quot;10rng&quot; and turn it into working, zero-cost C++ code. I =
notice that Zhihao implemented the much more conservative syntax <font face=
=3D"courier new, monospace">xrange(10)</font>, presumably by analogy with P=
ython. I like this. :)</div><div><br></div><div>=E2=80=93Arthur<br></div></=
div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/7909e1f5-68b4-4e73-a7ef-f73e9181bff6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7909e1f5-68b4-4e73-a7ef-f73e9181bff6=
%40isocpp.org</a>.<br />

------=_Part_3576_1353735132.1499296081219--

------=_Part_3575_389590199.1499296081219--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 5 Jul 2017 18:41:34 -0700 (PDT)
Raw View
------=_Part_3567_958051180.1499305294087
Content-Type: multipart/alternative;
 boundary="----=_Part_3568_1506435451.1499305294087"

------=_Part_3568_1506435451.1499305294087
Content-Type: text/plain; charset="UTF-8"

On Wednesday, July 5, 2017 at 7:08:01 PM UTC-4, Arthur O'Dwyer wrote:
>
> On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bolas wrote:
>>
>> On Wednesday, July 5, 2017 at 6:27:44 PM UTC-4, gmis...@gmail.com wrote:
>>>
>>> On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:
>>>>
>>>> On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:
>>>>>
>>>>> HI Nicol Bolas,
>>>>> Thanks for your comments.
>>>>>
>>>>> The idea is to simplify the for-loop where it can be possible, and
>>>>> that help ensuring faster and readable coding, at the same time there
>>>>> should be 0 impact on performance, which should be possible if adding this
>>>>> extension to the range-loop.
>>>>>
>>>>> Adding literals support to range-loop is definitely possible "with
>>>>> relative ease" to the compiler syntax parser and code generator and
>>>>> generate code that is exactly as the standard for-loop but much easier to
>>>>> read with such brevity therefore less prone to errors. Which was the main
>>>>> reasons for adding the range-for to the language after all.
>>>>>
>>>>
>>>> The difference is this: even with a range-ified `std::for_each`, you
>>>> could not get the exact equivalent of range-based `for`, due to having to
>>>> pass a functor. What you lose (among other things) is the ability to use
>>>> `break` to terminate the loop early. S a library solution would always be
>>>> inferior to the language solution.
>>>>
>>>> This is not true of what you're talking about. What I suggested can get
>>>> 100% of the desired behavior. As such, there is no *need* to have a
>>>> language solution, since we can get the same thing through the library.
>>>>
>>>> Not only that, we can do so much better with a library-based solution:
>>>>
>>>> for(auto i: 20rng) {} //Counts on the range [0, 20)
>>>> for(auto i: 20revrng) {} //Counts on the range (20, 0]
>>>> for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
>>>> for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
>>>> for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in
>>>> increments of 2
>>>>
>>>
>>> Really, you [ask] us to write this?
>>>
>>
>> I'm sorry, I don't understand what you were trying to say. If you're
>> saying that we shouldn't have something like `10rng` as shorthand for "an
>> integer range from 0 to 10", what's wrong with that?
>>
>
> Well, "rng" is an abbreviation for "random number generator", for one. ;)
> But I don't think Nicol is [or needs to be] arguing that we should
> *standardize* the UDL suffixes "rng" or "begin" or "end" or "step" or
> "revrng". The core point here seems to be [or should be] that Abdulla could
> go home right now and write those UDLs *himself*, and then he wouldn't
> desire a core language change anymore, because he'd have something just as
> useful and in fact infinitely more expressive and flexible, and also he
> could use it in C++11 today instead of only in C++20 tomorrow.
>

The point I'm making is not so much that you could do it yourself; after
all, you could implement std::vector yourself (except that you can't, but
that's another matter), but that's not an argument not to have it in the
standard library. My main point is that, if there is a need for C++ to
provide the ability to loop over numbers more easily, then a library
solution would have negligible downsides compared to a language solution.
And therefore, the library solution should be preferred.

Personally, I think this is something the standard library ought to
provide, though the UDL suffixes might be a bit much. But I swear by my
`_z` suffix; it's absolutely essential for looping over unsigned integers.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c9137815-ef08-4816-9423-bb27b98ccb11%40isocpp.org.

------=_Part_3568_1506435451.1499305294087
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, July 5, 2017 at 7:08:01 PM UTC-4, Arthur O&#=
39;Dwyer wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr=
">On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bolas wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Wednesday, July 5, 201=
7 at 6:27:44 PM UTC-4, <a>gmis...@gmail.com</a> wrote:<blockquote class=3D"=
gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid=
;padding-left:1ex"><div dir=3D"ltr">On Thursday, July 6, 2017 at 10:10:26 A=
M UTC+12, Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);bo=
rder-left-width:1px;border-left-style:solid"><div dir=3D"ltr">On Wednesday,=
 July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border=
-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"=
><div dir=3D"ltr">HI Nicol Bolas,=C2=A0<div>Thanks for your comments.</div>=
<div><br></div><div>The idea is to simplify the for-loop where it can be po=
ssible, and that help ensuring faster and readable coding, at the same time=
 there should be 0 impact on performance, which should be possible if addin=
g this extension to the range-loop.</div><div><br></div><div>Adding literal=
s support to range-loop is definitely possible &quot;with relative ease&quo=
t; to the compiler syntax parser and code generator and generate code that =
is exactly as the standard for-loop but much easier to read with such brevi=
ty therefore less prone to errors. Which was the main reasons for adding th=
e range-for to the language after all.</div></div></blockquote><div><br>The=
 difference is this: even with a range-ified `std::for_each`, you could not=
 get the exact equivalent of range-based `for`, due to having to pass a fun=
ctor. What you lose (among other things) is the ability to use `break` to t=
erminate the loop early. S a library solution would always be inferior to t=
he language solution.<br><br>This is not true of what you&#39;re talking ab=
out. What I suggested can get 100% of the desired behavior. As such, there =
is no <i>need</i> to have a language solution, since we can get the same th=
ing through the library.<br><br>Not only that, we can do so much better wit=
h a library-based solution:<br><br><div style=3D"border:1px solid rgb(187,1=
87,187);background-color:rgb(250,250,250)"><code><div><span style=3D"color:=
rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(</span><span =
style=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i=
</span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">20rng</span><span st=
yle=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0=
,0,0)"> </span><span style=3D"color:rgb(136,0,0)">//Counts on the range [0,=
 20)</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color=
:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(</span><span=
 style=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> =
i</span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:r=
gb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">20revrng</span><spa=
n style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(102,102,0)">{}</span><span style=3D"color:r=
gb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">//Counts on the range=
 (20, 0]</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"c=
olor:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(</span><=
span style=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0=
)"> i</span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"col=
or:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">4begin</span><s=
pan style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)"=
>|</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(=
0,102,102)">43end</span><span style=3D"color:rgb(102,102,0)">)</span><span =
style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136=
,0,0)">//Counts on the range [4, 43)</span><span style=3D"color:rgb(0,0,0)"=
><br></span><span style=3D"color:rgb(0,0,136)">for</span><span style=3D"col=
or:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)">auto</span><s=
pan style=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(102,102,0)=
">:</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb=
(0,102,102)">16begin</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(102,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </s=
pan><span style=3D"color:rgb(0,102,102)">12end</span><span style=3D"color:r=
gb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(136,0,0)">//Counts on the range (16, 12]</span><s=
pan style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)=
">for</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"col=
or:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i</span><span=
 style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(0,102,102)">20rng</span><span style=3D"color=
:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">|</span><span sty=
le=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">2step<=
/span><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb=
(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">//Counts o=
n the range [0, 20), in increments of 2</span></div></code></div></div></di=
v></blockquote><div><br></div><div>Really, you [ask] us to write this?</div=
></div></blockquote><div><br>I&#39;m sorry, I don&#39;t understand what you=
 were trying to say. If you&#39;re saying that we shouldn&#39;t have someth=
ing like `10rng` as shorthand for &quot;an integer range from 0 to 10&quot;=
, what&#39;s wrong with that?<br></div></div></blockquote><div><br></div><d=
iv>Well, &quot;rng&quot; is an abbreviation for &quot;random number generat=
or&quot;, for one. ;)</div><div>But I don&#39;t think Nicol is [or needs to=
 be] arguing that we should <i>standardize</i> the UDL suffixes &quot;rng&q=
uot; or &quot;begin&quot; or &quot;end&quot; or &quot;step&quot; or &quot;r=
evrng&quot;. The core point here seems to be [or should be] that Abdulla co=
uld go home right now and write those UDLs <i>himself</i>, and then he woul=
dn&#39;t desire a core language change anymore, because he&#39;d have somet=
hing just as useful and in fact infinitely more expressive and flexible, an=
d also he could use it in C++11 today instead of only in C++20 tomorrow.<br=
></div></div></blockquote><div><br>The point I&#39;m making is not so much =
that you could do it yourself; after all, you could implement std::vector y=
ourself (except that you can&#39;t, but that&#39;s another matter), but tha=
t&#39;s not an argument not to have it in the standard library. My main poi=
nt is that, if there is a need for C++ to provide the ability to loop over =
numbers more easily, then a library solution would have negligible downside=
s compared to a language solution. And therefore, the library solution shou=
ld be preferred.<br><br>Personally, I think this is something the standard =
library ought to provide, though the UDL suffixes might be a bit much. But =
I swear by my `_z` suffix; it&#39;s absolutely essential for looping over u=
nsigned integers.</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c9137815-ef08-4816-9423-bb27b98ccb11%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c9137815-ef08-4816-9423-bb27b98ccb11=
%40isocpp.org</a>.<br />

------=_Part_3568_1506435451.1499305294087--

------=_Part_3567_958051180.1499305294087--

.


Author: gmisocpp@gmail.com
Date: Wed, 5 Jul 2017 20:44:55 -0700 (PDT)
Raw View
------=_Part_3542_1008845870.1499312695487
Content-Type: multipart/alternative;
 boundary="----=_Part_3543_241611654.1499312695488"

------=_Part_3543_241611654.1499312695488
Content-Type: text/plain; charset="UTF-8"


Will the mythical standard library 2 I keep hearing about make std::size_t
a signed value?
If so, maybe then there is no need for _z?
Otherwise, I'm surprised _z isn't in C++17 already.

I am open to a language change though if it made the most common case the
easiest. Something like:

for (auto i : v.size())
    whatever();
// Above generate code as if:
for (decltype(v.size() ) i{0}; i < v.size(); ++i)
    whatever();

On Thursday, July 6, 2017 at 1:41:34 PM UTC+12, Nicol Bolas wrote:

> On Wednesday, July 5, 2017 at 7:08:01 PM UTC-4, Arthur O'Dwyer wrote:
>>
>> On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bolas wrote:
>>>
>>> On Wednesday, July 5, 2017 at 6:27:44 PM UTC-4, gmis...@gmail.com wrote:
>>>>
>>>> On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:
>>>>>
>>>>> On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah
>>>>> wrote:
>>>>>>
>>>>>> HI Nicol Bolas,
>>>>>> Thanks for your comments.
>>>>>>
>>>>>> The idea is to simplify the for-loop where it can be possible, and
>>>>>> that help ensuring faster and readable coding, at the same time there
>>>>>> should be 0 impact on performance, which should be possible if adding this
>>>>>> extension to the range-loop.
>>>>>>
>>>>>> Adding literals support to range-loop is definitely possible "with
>>>>>> relative ease" to the compiler syntax parser and code generator and
>>>>>> generate code that is exactly as the standard for-loop but much easier to
>>>>>> read with such brevity therefore less prone to errors. Which was the main
>>>>>> reasons for adding the range-for to the language after all.
>>>>>>
>>>>>
>>>>> The difference is this: even with a range-ified `std::for_each`, you
>>>>> could not get the exact equivalent of range-based `for`, due to having to
>>>>> pass a functor. What you lose (among other things) is the ability to use
>>>>> `break` to terminate the loop early. S a library solution would always be
>>>>> inferior to the language solution.
>>>>>
>>>>> This is not true of what you're talking about. What I suggested can
>>>>> get 100% of the desired behavior. As such, there is no *need* to have
>>>>> a language solution, since we can get the same thing through the library.
>>>>>
>>>>> Not only that, we can do so much better with a library-based solution:
>>>>>
>>>>> for(auto i: 20rng) {} //Counts on the range [0, 20)
>>>>> for(auto i: 20revrng) {} //Counts on the range (20, 0]
>>>>> for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
>>>>> for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
>>>>> for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in
>>>>> increments of 2
>>>>>
>>>>
>>>> Really, you [ask] us to write this?
>>>>
>>>
>>> I'm sorry, I don't understand what you were trying to say. If you're
>>> saying that we shouldn't have something like `10rng` as shorthand for "an
>>> integer range from 0 to 10", what's wrong with that?
>>>
>>
>> Well, "rng" is an abbreviation for "random number generator", for one. ;)
>> But I don't think Nicol is [or needs to be] arguing that we should
>> *standardize* the UDL suffixes "rng" or "begin" or "end" or "step" or
>> "revrng". The core point here seems to be [or should be] that Abdulla could
>> go home right now and write those UDLs *himself*, and then he wouldn't
>> desire a core language change anymore, because he'd have something just as
>> useful and in fact infinitely more expressive and flexible, and also he
>> could use it in C++11 today instead of only in C++20 tomorrow.
>>
>
> The point I'm making is not so much that you could do it yourself; after
> all, you could implement std::vector yourself (except that you can't, but
> that's another matter), but that's not an argument not to have it in the
> standard library. My main point is that, if there is a need for C++ to
> provide the ability to loop over numbers more easily, then a library
> solution would have negligible downsides compared to a language solution.
> And therefore, the library solution should be preferred.
>
> Personally, I think this is something the standard library ought to
> provide, though the UDL suffixes might be a bit much. But I swear by my
> `_z` suffix; it's absolutely essential for looping over unsigned integers.
>

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/42665738-ecdb-4a1f-a2ef-1e466db91b7f%40isocpp.org.

------=_Part_3543_241611654.1499312695488
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div><div>Will the mythical standard library=C2=
=A02 I keep hearing about make=C2=A0std::size_t a signed value?</div><div>I=
f so, maybe then there is no need for _z?</div><div>Otherwise, I&#39;m surp=
rised _z isn&#39;t in C++17 already.</div><div><br></div><div>I=C2=A0am ope=
n=C2=A0to a language change though if it=C2=A0made the most common=C2=A0cas=
e the easiest. Something like:</div><div><br></div><div>for (auto i=C2=A0: =
v.size())</div><div>=C2=A0=C2=A0=C2=A0 whatever();</div><div>// Above gener=
ate code=C2=A0as if:</div><div>for (decltype(v.size() ) i{0};=C2=A0i &lt; v=
..size(); ++i)</div><div>=C2=A0=C2=A0=C2=A0 whatever();</div><div><br>On Thu=
rsday, July 6, 2017 at 1:41:34 PM UTC+12, Nicol Bolas wrote:</div><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: =
1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-=
left-style: solid;"><div dir=3D"ltr">On Wednesday, July 5, 2017 at 7:08:01 =
PM UTC-4, Arthur O&#39;Dwyer wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(20=
4, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=
=3D"ltr">On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bolas wrote:=
<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddi=
ng-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px=
; border-left-style: solid;"><div dir=3D"ltr">On Wednesday, July 5, 2017 at=
 6:27:44 PM UTC-4, <a>gmis...@gmail.com</a> wrote:<blockquote class=3D"gmai=
l_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left=
-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: soli=
d;"><div dir=3D"ltr">On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol=
 Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px=
 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-le=
ft-width: 1px; border-left-style: solid;"><div dir=3D"ltr">On Wednesday, Ju=
ly 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;"><div dir=3D"ltr">HI Nicol Bolas,=C2=A0<div>Thanks for your comm=
ents.</div><div><br></div><div>The idea is to simplify the for-loop where i=
t can be possible, and that help ensuring faster and readable coding, at th=
e same time there should be 0 impact on performance, which should be possib=
le if adding this extension to the range-loop.</div><div><br></div><div>Add=
ing literals support to range-loop is definitely possible &quot;with relati=
ve ease&quot; to the compiler syntax parser and code generator and generate=
 code that is exactly as the standard for-loop but much easier to read with=
 such brevity therefore less prone to errors. Which was the main reasons fo=
r adding the range-for to the language after all.</div></div></blockquote><=
div><br>The difference is this: even with a range-ified `std::for_each`, yo=
u could not get the exact equivalent of range-based `for`, due to having to=
 pass a functor. What you lose (among other things) is the ability to use `=
break` to terminate the loop early. S a library solution would always be in=
ferior to the language solution.<br><br>This is not true of what you&#39;re=
 talking about. What I suggested can get 100% of the desired behavior. As s=
uch, there is no <i>need</i> to have a language solution, since we can get =
the same thing through the library.<br><br>Not only that, we can do so much=
 better with a library-based solution:<br><br><div style=3D"border: 1px sol=
id rgb(187, 187, 187); border-image: none; background-color: rgb(250, 250, =
250);"><code><div><span style=3D"color: rgb(0, 0, 136);">for</span><span st=
yle=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 13=
6);">auto</span><span style=3D"color: rgb(0, 0, 0);"> i</span><span style=
=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(0, 102, 102);">20rng</span><span style=3D=
"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </=
span><span style=3D"color: rgb(102, 102, 0);">{}</span><span style=3D"color=
: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">//Counts on=
 the range [0, 20)</span><span style=3D"color: rgb(0, 0, 0);"><br></span><s=
pan style=3D"color: rgb(0, 0, 136);">for</span><span style=3D"color: rgb(10=
2, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">auto</span><spa=
n style=3D"color: rgb(0, 0, 0);"> i</span><span style=3D"color: rgb(102, 10=
2, 0);">:</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D=
"color: rgb(0, 102, 102);">20revrng</span><span style=3D"color: rgb(102, 10=
2, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D=
"color: rgb(102, 102, 0);">{}</span><span style=3D"color: rgb(0, 0, 0);"> <=
/span><span style=3D"color: rgb(136, 0, 0);">//Counts on the range (20, 0]<=
/span><span style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color:=
 rgb(0, 0, 136);">for</span><span style=3D"color: rgb(102, 102, 0);">(</spa=
n><span style=3D"color: rgb(0, 0, 136);">auto</span><span style=3D"color: r=
gb(0, 0, 0);"> i</span><span style=3D"color: rgb(102, 102, 0);">:</span><sp=
an style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102,=
 102);">4begin</span><span style=3D"color: rgb(0, 0, 0);"> </span><span sty=
le=3D"color: rgb(102, 102, 0);">|</span><span style=3D"color: rgb(0, 0, 0);=
"> </span><span style=3D"color: rgb(0, 102, 102);">43end</span><span style=
=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(102, 102, 0);">{}</span><span style=3D"co=
lor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">//Counts=
 on the range [4, 43)</span><span style=3D"color: rgb(0, 0, 0);"><br></span=
><span style=3D"color: rgb(0, 0, 136);">for</span><span style=3D"color: rgb=
(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">auto</span><=
span style=3D"color: rgb(0, 0, 0);"> i</span><span style=3D"color: rgb(102,=
 102, 0);">:</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 102, 102);">16begin</span><span style=3D"color: rgb(0, 0,=
 0);"> </span><span style=3D"color: rgb(102, 102, 0);">|</span><span style=
=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">=
12end</span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D=
"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">{}<=
/span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rg=
b(136, 0, 0);">//Counts on the range (16, 12]</span><span style=3D"color: r=
gb(0, 0, 0);"><br></span><span style=3D"color: rgb(0, 0, 136);">for</span><=
span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0=
, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);"> i</span><span =
style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color: rgb(0, 0, =
0);"> </span><span style=3D"color: rgb(0, 102, 102);">20rng</span><span sty=
le=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);=
">|</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color=
: rgb(0, 102, 102);">2step</span><span style=3D"color: rgb(102, 102, 0);">)=
</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: r=
gb(102, 102, 0);">{}</span><span style=3D"color: rgb(0, 0, 0);"> </span><sp=
an style=3D"color: rgb(136, 0, 0);">//Counts on the range [0, 20), in incre=
ments of 2</span></div></code></div></div></div></blockquote><div><br></div=
><div>Really, you [ask] us to write this?</div></div></blockquote><div><br>=
I&#39;m sorry, I don&#39;t understand what you were trying to say. If you&#=
39;re saying that we shouldn&#39;t have something like `10rng` as shorthand=
 for &quot;an integer range from 0 to 10&quot;, what&#39;s wrong with that?=
<br></div></div></blockquote><div><br></div><div>Well, &quot;rng&quot; is a=
n abbreviation for &quot;random number generator&quot;, for one. ;)</div><d=
iv>But I don&#39;t think Nicol is [or needs to be] arguing that we should <=
i>standardize</i> the UDL suffixes &quot;rng&quot; or &quot;begin&quot; or =
&quot;end&quot; or &quot;step&quot; or &quot;revrng&quot;. The core point h=
ere seems to be [or should be] that Abdulla could go home right now and wri=
te those UDLs <i>himself</i>, and then he wouldn&#39;t desire a core langua=
ge change anymore, because he&#39;d have something just as useful and in fa=
ct infinitely more expressive and flexible, and also he could use it in C++=
11 today instead of only in C++20 tomorrow.<br></div></div></blockquote><di=
v><br>The point I&#39;m making is not so much that you could do it yourself=
; after all, you could implement std::vector yourself (except that you can&=
#39;t, but that&#39;s another matter), but that&#39;s not an argument not t=
o have it in the standard library. My main point is that, if there is a nee=
d for C++ to provide the ability to loop over numbers more easily, then a l=
ibrary solution would have negligible downsides compared to a language solu=
tion. And therefore, the library solution should be preferred.<br><br>Perso=
nally, I think this is something the standard library ought to provide, tho=
ugh the UDL suffixes might be a bit much. But I swear by my `_z` suffix; it=
&#39;s absolutely essential for looping over unsigned integers.</div></div>=
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/42665738-ecdb-4a1f-a2ef-1e466db91b7f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/42665738-ecdb-4a1f-a2ef-1e466db91b7f=
%40isocpp.org</a>.<br />

------=_Part_3543_241611654.1499312695488--

------=_Part_3542_1008845870.1499312695487--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 6 Jul 2017 06:32:05 -0700 (PDT)
Raw View
------=_Part_3780_1933183245.1499347925455
Content-Type: multipart/alternative;
 boundary="----=_Part_3781_343066257.1499347925455"

------=_Part_3781_343066257.1499347925455
Content-Type: text/plain; charset="UTF-8"

On Wednesday, July 5, 2017 at 11:44:55 PM UTC-4, gmis...@gmail.com wrote:
>
>
> Will the mythical standard library 2 I keep hearing about make std::size_t
> a signed value?
>

No. The most it might do is make `std*2*::size_t` a signed type. But that
would be pointless since `sizeof` and `alignof` would still be returning
`std::size_t`.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d45d669d-6a81-423d-8712-4f52f9d5173c%40isocpp.org.

------=_Part_3781_343066257.1499347925455
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, July 5, 2017 at 11:44:55 PM UTC-4, gmis...@g=
mail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr=
"><div><br></div><div>Will the mythical standard library=C2=A02 I keep hear=
ing about make=C2=A0std::size_t a signed value?</div></div></blockquote><di=
v><br>No. The most it might do is make `std<u><i><b>2</b></i></u>::size_t` =
a signed type. But that would be pointless since `sizeof` and `alignof` wou=
ld still be returning `std::size_t`.</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d45d669d-6a81-423d-8712-4f52f9d5173c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d45d669d-6a81-423d-8712-4f52f9d5173c=
%40isocpp.org</a>.<br />

------=_Part_3781_343066257.1499347925455--

------=_Part_3780_1933183245.1499347925455--

.


Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Fri, 7 Jul 2017 04:37:16 -0700 (PDT)
Raw View
------=_Part_4573_1586989253.1499427437023
Content-Type: multipart/alternative;
 boundary="----=_Part_4574_487666174.1499427437024"

------=_Part_4574_487666174.1499427437024
Content-Type: text/plain; charset="UTF-8"


I think this would be a worthwhile extension. The special literal trick
only works for literals but the more important use case is like the example
below where the loop limit is a vector size or some other non constant
value.

Going back to the original proposal I don't see the point of the
for (1 : 10)

version as there is no point in selecting the loop init value when there is
no loop variable to inspect. However, I sometimes get into trouble when
writing a loop where the loop variable is not needed in the loop body: I
get compiler warnings about unused variables. While this can be considered
a compiler bug it still has some value to be able to describe that the loop
variable is not needed. Thus it would be possible to allow:

for (:v.size())
    whatever();

but then again a special marker for "the unused varaible" would be more
useful, such as:

for (auto ? : v.size())
    whatever();



> I am open to a language change though if it made the most common case the
> easiest. Something like:
>
> for (auto i : v.size())
>     whatever();
> // Above generate code as if:
> for (decltype(v.size() ) i{0}; i < v.size(); ++i)
>     whatever();
>
> On Thursday, July 6, 2017 at 1:41:34 PM UTC+12, Nicol Bolas wrote:
>
>> On Wednesday, July 5, 2017 at 7:08:01 PM UTC-4, Arthur O'Dwyer wrote:
>>>
>>> On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bolas wrote:
>>>>
>>>> On Wednesday, July 5, 2017 at 6:27:44 PM UTC-4, gmis...@gmail.com
>>>> wrote:
>>>>>
>>>>> On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:
>>>>>>
>>>>>> On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah
>>>>>> wrote:
>>>>>>>
>>>>>>> HI Nicol Bolas,
>>>>>>> Thanks for your comments.
>>>>>>>
>>>>>>> The idea is to simplify the for-loop where it can be possible, and
>>>>>>> that help ensuring faster and readable coding, at the same time there
>>>>>>> should be 0 impact on performance, which should be possible if adding this
>>>>>>> extension to the range-loop.
>>>>>>>
>>>>>>> Adding literals support to range-loop is definitely possible "with
>>>>>>> relative ease" to the compiler syntax parser and code generator and
>>>>>>> generate code that is exactly as the standard for-loop but much easier to
>>>>>>> read with such brevity therefore less prone to errors. Which was the main
>>>>>>> reasons for adding the range-for to the language after all.
>>>>>>>
>>>>>>
>>>>>> The difference is this: even with a range-ified `std::for_each`, you
>>>>>> could not get the exact equivalent of range-based `for`, due to having to
>>>>>> pass a functor. What you lose (among other things) is the ability to use
>>>>>> `break` to terminate the loop early. S a library solution would always be
>>>>>> inferior to the language solution.
>>>>>>
>>>>>> This is not true of what you're talking about. What I suggested can
>>>>>> get 100% of the desired behavior. As such, there is no *need* to
>>>>>> have a language solution, since we can get the same thing through the
>>>>>> library.
>>>>>>
>>>>>> Not only that, we can do so much better with a library-based solution:
>>>>>>
>>>>>> for(auto i: 20rng) {} //Counts on the range [0, 20)
>>>>>> for(auto i: 20revrng) {} //Counts on the range (20, 0]
>>>>>> for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
>>>>>> for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
>>>>>> for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in
>>>>>> increments of 2
>>>>>>
>>>>>
>>>>> Really, you [ask] us to write this?
>>>>>
>>>>
>>>> I'm sorry, I don't understand what you were trying to say. If you're
>>>> saying that we shouldn't have something like `10rng` as shorthand for "an
>>>> integer range from 0 to 10", what's wrong with that?
>>>>
>>>
>>> Well, "rng" is an abbreviation for "random number generator", for one. ;)
>>> But I don't think Nicol is [or needs to be] arguing that we should
>>> *standardize* the UDL suffixes "rng" or "begin" or "end" or "step" or
>>> "revrng". The core point here seems to be [or should be] that Abdulla could
>>> go home right now and write those UDLs *himself*, and then he wouldn't
>>> desire a core language change anymore, because he'd have something just as
>>> useful and in fact infinitely more expressive and flexible, and also he
>>> could use it in C++11 today instead of only in C++20 tomorrow.
>>>
>>
>> The point I'm making is not so much that you could do it yourself; after
>> all, you could implement std::vector yourself (except that you can't, but
>> that's another matter), but that's not an argument not to have it in the
>> standard library. My main point is that, if there is a need for C++ to
>> provide the ability to loop over numbers more easily, then a library
>> solution would have negligible downsides compared to a language solution.
>> And therefore, the library solution should be preferred.
>>
>> Personally, I think this is something the standard library ought to
>> provide, though the UDL suffixes might be a bit much. But I swear by my
>> `_z` suffix; it's absolutely essential for looping over unsigned integers.
>>
>

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/19a415fb-75d2-4a62-9b4e-6a3840c9744d%40isocpp.org.

------=_Part_4574_487666174.1499427437024
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div>I think this would be a worthwhile extension. The=
 special literal trick only works for literals but the more important use c=
ase is like the example below where the loop limit is a vector size or some=
 other non constant value.</div><div><br></div><div>Going back to the origi=
nal proposal I don&#39;t see the point of the <div class=3D"prettyprint" st=
yle=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 18=
7); border-style: solid; border-width: 1px; word-wrap: break-word;"><code c=
lass=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">for</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><font color=3D"#006666"><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">1</span></font><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">10</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)<=
/span></div></code></div><br> version as there is no point in selecting the=
 loop init value when there is no loop variable to inspect. However, I some=
times get into trouble when writing a loop where the loop variable is not n=
eeded in the loop body: I get compiler warnings about unused variables. Whi=
le this can be considered a compiler bug it still has some value to be able=
 to describe that the loop variable is not needed. Thus it would be possibl=
e to allow:</div><div><br></div><div>for (:v.size())</div><div>=C2=A0 =C2=
=A0 whatever();</div><div><br></div><div>but then again a special marker fo=
r &quot;the unused varaible&quot; would be more useful, such as:</div><div>=
<br></div><div>for (auto ? : v.size())</div><div>=C2=A0 =C2=A0 whatever();<=
/div><div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left:=
 1ex;"><div dir=3D"ltr"><div></div><div>I=C2=A0am open=C2=A0to a language c=
hange though if it=C2=A0made the most common=C2=A0case the easiest. Somethi=
ng like:</div><div><br></div><div>for (auto i=C2=A0: v.size())</div><div>=
=C2=A0=C2=A0=C2=A0 whatever();</div><div>// Above generate code=C2=A0as if:=
</div><div>for (decltype(v.size() ) i{0};=C2=A0i &lt; v.size(); ++i)</div><=
div>=C2=A0=C2=A0=C2=A0 whatever();</div><div><br>On Thursday, July 6, 2017 =
at 1:41:34 PM UTC+12, Nicol Bolas wrote:</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:r=
gb(204,204,204);border-left-width:1px;border-left-style:solid"><div dir=3D"=
ltr">On Wednesday, July 5, 2017 at 7:08:01 PM UTC-4, Arthur O&#39;Dwyer wro=
te:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padd=
ing-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;borde=
r-left-style:solid"><div dir=3D"ltr">On Wednesday, July 5, 2017 at 3:41:21 =
PM UTC-7, Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);bo=
rder-left-width:1px;border-left-style:solid"><div dir=3D"ltr">On Wednesday,=
 July 5, 2017 at 6:27:44 PM UTC-4, <a>gmis...@gmail.com</a> wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex=
;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style=
:solid"><div dir=3D"ltr">On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, N=
icol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-w=
idth:1px;border-left-style:solid"><div dir=3D"ltr">On Wednesday, July 5, 20=
17 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote:<blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color=
:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div dir=
=3D"ltr">HI Nicol Bolas,=C2=A0<div>Thanks for your comments.</div><div><br>=
</div><div>The idea is to simplify the for-loop where it can be possible, a=
nd that help ensuring faster and readable coding, at the same time there sh=
ould be 0 impact on performance, which should be possible if adding this ex=
tension to the range-loop.</div><div><br></div><div>Adding literals support=
 to range-loop is definitely possible &quot;with relative ease&quot; to the=
 compiler syntax parser and code generator and generate code that is exactl=
y as the standard for-loop but much easier to read with such brevity theref=
ore less prone to errors. Which was the main reasons for adding the range-f=
or to the language after all.</div></div></blockquote><div><br>The differen=
ce is this: even with a range-ified `std::for_each`, you could not get the =
exact equivalent of range-based `for`, due to having to pass a functor. Wha=
t you lose (among other things) is the ability to use `break` to terminate =
the loop early. S a library solution would always be inferior to the langua=
ge solution.<br><br>This is not true of what you&#39;re talking about. What=
 I suggested can get 100% of the desired behavior. As such, there is no <i>=
need</i> to have a language solution, since we can get the same thing throu=
gh the library.<br><br>Not only that, we can do so much better with a libra=
ry-based solution:<br><br><div style=3D"border:1px solid rgb(187,187,187);b=
ackground-color:rgb(250,250,250)"><code><div><span style=3D"color:rgb(0,0,1=
36)">for</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"=
color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i</span><s=
pan style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"=
> </span><span style=3D"color:rgb(0,102,102)">20rng</span><span style=3D"co=
lor:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span><span =
style=3D"color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(136,0,0)">//Counts on the range [0, 20)</spa=
n><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,=
136)">for</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D=
"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i</span><=
span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)=
"> </span><span style=3D"color:rgb(0,102,102)">20revrng</span><span style=
=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0,0,=
0)"> </span><span style=3D"color:rgb(136,0,0)">//Counts on the range (20, 0=
]</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rg=
b(0,0,136)">for</span><span style=3D"color:rgb(102,102,0)">(</span><span st=
yle=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i</=
span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(=
0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">4begin</span><span sty=
le=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">|</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,1=
02)">43end</span><span style=3D"color:rgb(102,102,0)">)</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}</span=
><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)=
">//Counts on the range [4, 43)</span><span style=3D"color:rgb(0,0,0)"><br>=
</span><span style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rg=
b(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)">auto</span><span s=
tyle=3D"color:rgb(0,0,0)"> i</span><span style=3D"color:rgb(102,102,0)">:</=
span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,10=
2,102)">16begin</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(102,102,0)">|</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(0,102,102)">12end</span><span style=3D"color:rgb(1=
02,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"=
color:rgb(102,102,0)">{}</span><span style=3D"color:rgb(0,0,0)"> </span><sp=
an style=3D"color:rgb(136,0,0)">//Counts on the range (16, 12]</span><span =
style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)">fo=
r</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:r=
gb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> i</span><span sty=
le=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(0,102,102)">20rng</span><span style=3D"color:rgb=
(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">|</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">2step</s=
pan><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0=
,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{}</span><span style=3D=
"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0)">//Counts on t=
he range [0, 20), in increments of 2</span></div></code></div></div></div><=
/blockquote><div><br></div><div>Really, you [ask] us to write this?</div></=
div></blockquote><div><br>I&#39;m sorry, I don&#39;t understand what you we=
re trying to say. If you&#39;re saying that we shouldn&#39;t have something=
 like `10rng` as shorthand for &quot;an integer range from 0 to 10&quot;, w=
hat&#39;s wrong with that?<br></div></div></blockquote><div><br></div><div>=
Well, &quot;rng&quot; is an abbreviation for &quot;random number generator&=
quot;, for one. ;)</div><div>But I don&#39;t think Nicol is [or needs to be=
] arguing that we should <i>standardize</i> the UDL suffixes &quot;rng&quot=
; or &quot;begin&quot; or &quot;end&quot; or &quot;step&quot; or &quot;revr=
ng&quot;. The core point here seems to be [or should be] that Abdulla could=
 go home right now and write those UDLs <i>himself</i>, and then he wouldn&=
#39;t desire a core language change anymore, because he&#39;d have somethin=
g just as useful and in fact infinitely more expressive and flexible, and a=
lso he could use it in C++11 today instead of only in C++20 tomorrow.<br></=
div></div></blockquote><div><br>The point I&#39;m making is not so much tha=
t you could do it yourself; after all, you could implement std::vector your=
self (except that you can&#39;t, but that&#39;s another matter), but that&#=
39;s not an argument not to have it in the standard library. My main point =
is that, if there is a need for C++ to provide the ability to loop over num=
bers more easily, then a library solution would have negligible downsides c=
ompared to a language solution. And therefore, the library solution should =
be preferred.<br><br>Personally, I think this is something the standard lib=
rary ought to provide, though the UDL suffixes might be a bit much. But I s=
wear by my `_z` suffix; it&#39;s absolutely essential for looping over unsi=
gned integers.</div></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/19a415fb-75d2-4a62-9b4e-6a3840c9744d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/19a415fb-75d2-4a62-9b4e-6a3840c9744d=
%40isocpp.org</a>.<br />

------=_Part_4574_487666174.1499427437024--

------=_Part_4573_1586989253.1499427437023--

.


Author: gmisocpp@gmail.com
Date: Fri, 7 Jul 2017 05:08:50 -0700 (PDT)
Raw View
------=_Part_1722_184526921.1499429330418
Content-Type: multipart/alternative;
 boundary="----=_Part_1723_934168662.1499429330419"

------=_Part_1723_934168662.1499429330419
Content-Type: text/plain; charset="UTF-8"

Maybe I'm reading your post wrong, but t seems to be a pretty rare loop
that doesn't need the variable?
And why have a : at all in that case, why not?
for (v.size())
    whatever();


On Friday, July 7, 2017 at 11:37:17 PM UTC+12, Bengt Gustafsson wrote:

>
> I think this would be a worthwhile extension. The special literal trick
> only works for literals but the more important use case is like the example
> below where the loop limit is a vector size or some other non constant
> value.
>
> Going back to the original proposal I don't see the point of the
> for (1 : 10)
>
> version as there is no point in selecting the loop init value when there
> is no loop variable to inspect. However, I sometimes get into trouble when
> writing a loop where the loop variable is not needed in the loop body: I
> get compiler warnings about unused variables. While this can be considered
> a compiler bug it still has some value to be able to describe that the loop
> variable is not needed. Thus it would be possible to allow:
>
> for (:v.size())
>     whatever();
>
> but then again a special marker for "the unused varaible" would be more
> useful, such as:
>
> for (auto ? : v.size())
>     whatever();
>
>
>
>> I am open to a language change though if it made the most common case the
>> easiest. Something like:
>>
>> for (auto i : v.size())
>>     whatever();
>> // Above generate code as if:
>> for (decltype(v.size() ) i{0}; i < v.size(); ++i)
>>     whatever();
>>
>> On Thursday, July 6, 2017 at 1:41:34 PM UTC+12, Nicol Bolas wrote:
>>
>>> On Wednesday, July 5, 2017 at 7:08:01 PM UTC-4, Arthur O'Dwyer wrote:
>>>>
>>>> On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7, Nicol Bolas wrote:
>>>>>
>>>>> On Wednesday, July 5, 2017 at 6:27:44 PM UTC-4, gmis...@gmail.com
>>>>> wrote:
>>>>>>
>>>>>> On Thursday, July 6, 2017 at 10:10:26 AM UTC+12, Nicol Bolas wrote:
>>>>>>>
>>>>>>> On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> HI Nicol Bolas,
>>>>>>>> Thanks for your comments.
>>>>>>>>
>>>>>>>> The idea is to simplify the for-loop where it can be possible, and
>>>>>>>> that help ensuring faster and readable coding, at the same time there
>>>>>>>> should be 0 impact on performance, which should be possible if adding this
>>>>>>>> extension to the range-loop.
>>>>>>>>
>>>>>>>> Adding literals support to range-loop is definitely possible "with
>>>>>>>> relative ease" to the compiler syntax parser and code generator and
>>>>>>>> generate code that is exactly as the standard for-loop but much easier to
>>>>>>>> read with such brevity therefore less prone to errors. Which was the main
>>>>>>>> reasons for adding the range-for to the language after all.
>>>>>>>>
>>>>>>>
>>>>>>> The difference is this: even with a range-ified `std::for_each`, you
>>>>>>> could not get the exact equivalent of range-based `for`, due to having to
>>>>>>> pass a functor. What you lose (among other things) is the ability to use
>>>>>>> `break` to terminate the loop early. S a library solution would always be
>>>>>>> inferior to the language solution.
>>>>>>>
>>>>>>> This is not true of what you're talking about. What I suggested can
>>>>>>> get 100% of the desired behavior. As such, there is no *need* to
>>>>>>> have a language solution, since we can get the same thing through the
>>>>>>> library.
>>>>>>>
>>>>>>> Not only that, we can do so much better with a library-based
>>>>>>> solution:
>>>>>>>
>>>>>>> for(auto i: 20rng) {} //Counts on the range [0, 20)
>>>>>>> for(auto i: 20revrng) {} //Counts on the range (20, 0]
>>>>>>> for(auto i: 4begin | 43end) {} //Counts on the range [4, 43)
>>>>>>> for(auto i: 16begin | 12end) {} //Counts on the range (16, 12]
>>>>>>> for(auto i: 20rng | 2step) {} //Counts on the range [0, 20), in
>>>>>>> increments of 2
>>>>>>>
>>>>>>
>>>>>> Really, you [ask] us to write this?
>>>>>>
>>>>>
>>>>> I'm sorry, I don't understand what you were trying to say. If you're
>>>>> saying that we shouldn't have something like `10rng` as shorthand for "an
>>>>> integer range from 0 to 10", what's wrong with that?
>>>>>
>>>>
>>>> Well, "rng" is an abbreviation for "random number generator", for one.
>>>> ;)
>>>> But I don't think Nicol is [or needs to be] arguing that we should
>>>> *standardize* the UDL suffixes "rng" or "begin" or "end" or "step" or
>>>> "revrng". The core point here seems to be [or should be] that Abdulla could
>>>> go home right now and write those UDLs *himself*, and then he wouldn't
>>>> desire a core language change anymore, because he'd have something just as
>>>> useful and in fact infinitely more expressive and flexible, and also he
>>>> could use it in C++11 today instead of only in C++20 tomorrow.
>>>>
>>>
>>> The point I'm making is not so much that you could do it yourself; after
>>> all, you could implement std::vector yourself (except that you can't, but
>>> that's another matter), but that's not an argument not to have it in the
>>> standard library. My main point is that, if there is a need for C++ to
>>> provide the ability to loop over numbers more easily, then a library
>>> solution would have negligible downsides compared to a language solution.
>>> And therefore, the library solution should be preferred.
>>>
>>> Personally, I think this is something the standard library ought to
>>> provide, though the UDL suffixes might be a bit much. But I swear by my
>>> `_z` suffix; it's absolutely essential for looping over unsigned integers.
>>>
>>

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/eab780da-c6ef-44aa-adc9-606231dfbcb0%40isocpp.org.

------=_Part_1723_934168662.1499429330419
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Maybe I&#39;m reading your post wrong, but t seems to=
=C2=A0be a pretty rare loop that doesn&#39;t need the variable?</div><div>A=
nd why have a : at all in that case, why not?</div><div><div>for (v.size())=
</div><div>=C2=A0=C2=A0=C2=A0 whatever();</div><br><br>On Friday, July 7, 2=
017 at 11:37:17 PM UTC+12, Bengt Gustafsson wrote:</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;"><div dir=3D"ltr"><br><div>I think this would be a worthwhile ex=
tension. The special literal trick only works for literals but the more imp=
ortant use case is like the example below where the loop limit is a vector =
size or some other non constant value.</div><div><br></div><div>Going back =
to the original proposal I don&#39;t see the point of the <div style=3D"bor=
der: 1px solid rgb(187, 187, 187); border-image: none; -ms-word-wrap: break=
-word; background-color: rgb(250, 250, 250);"><code><div><span style=3D"col=
or: rgb(0, 0, 136);">for</span><span style=3D"color: rgb(0, 0, 0);"> </span=
><span style=3D"color: rgb(102, 102, 0);">(</span><font color=3D"#006666"><=
span style=3D"color: rgb(0, 102, 102);">1</span></font><span style=3D"color=
: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">:</span><=
span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 10=
2, 102);">10</span><span style=3D"color: rgb(102, 102, 0);">)</span></div><=
/code></div><br> version as there is no point in selecting the loop init va=
lue when there is no loop variable to inspect. However, I sometimes get int=
o trouble when writing a loop where the loop variable is not needed in the =
loop body: I get compiler warnings about unused variables. While this can b=
e considered a compiler bug it still has some value to be able to describe =
that the loop variable is not needed. Thus it would be possible to allow:</=
div><div><br></div><div>for (:v.size())</div><div>=C2=A0 =C2=A0 whatever();=
</div><div><br></div><div>but then again a special marker for &quot;the unu=
sed varaible&quot; would be more useful, such as:</div><div><br></div><div>=
for (auto ? : v.size())</div><div>=C2=A0 =C2=A0 whatever();</div><div><br><=
/div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: 0p=
x 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); =
border-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div></=
div><div>I=C2=A0am open=C2=A0to a language change though if it=C2=A0made th=
e most common=C2=A0case the easiest. Something like:</div><div><br></div><d=
iv>for (auto i=C2=A0: v.size())</div><div>=C2=A0=C2=A0=C2=A0 whatever();</d=
iv><div>// Above generate code=C2=A0as if:</div><div>for (decltype(v.size()=
 ) i{0};=C2=A0i &lt; v.size(); ++i)</div><div>=C2=A0=C2=A0=C2=A0 whatever()=
;</div><div><br>On Thursday, July 6, 2017 at 1:41:34 PM UTC+12, Nicol Bolas=
 wrote:</div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px=
 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-le=
ft-width: 1px; border-left-style: solid;"><div dir=3D"ltr">On Wednesday, Ju=
ly 5, 2017 at 7:08:01 PM UTC-4, Arthur O&#39;Dwyer wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;"><div dir=3D"ltr">On Wednesday, July 5, 2017 at 3:41:21 PM UTC-7=
, Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px =
0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); bo=
rder-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr">On Wednes=
day, July 5, 2017 at 6:27:44 PM UTC-4, <a>gmis...@gmail.com</a> wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-le=
ft: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; bor=
der-left-style: solid;"><div dir=3D"ltr">On Thursday, July 6, 2017 at 10:10=
:26 AM UTC+12, Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D=
"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, =
204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=3D"l=
tr">On Wednesday, July 5, 2017 at 4:36:55 PM UTC-4, Abdulla Herzallah wrote=
:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padd=
ing-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1p=
x; border-left-style: solid;"><div dir=3D"ltr">HI Nicol Bolas,=C2=A0<div>Th=
anks for your comments.</div><div><br></div><div>The idea is to simplify th=
e for-loop where it can be possible, and that help ensuring faster and read=
able coding, at the same time there should be 0 impact on performance, whic=
h should be possible if adding this extension to the range-loop.</div><div>=
<br></div><div>Adding literals support to range-loop is definitely possible=
 &quot;with relative ease&quot; to the compiler syntax parser and code gene=
rator and generate code that is exactly as the standard for-loop but much e=
asier to read with such brevity therefore less prone to errors. Which was t=
he main reasons for adding the range-for to the language after all.</div></=
div></blockquote><div><br>The difference is this: even with a range-ified `=
std::for_each`, you could not get the exact equivalent of range-based `for`=
, due to having to pass a functor. What you lose (among other things) is th=
e ability to use `break` to terminate the loop early. S a library solution =
would always be inferior to the language solution.<br><br>This is not true =
of what you&#39;re talking about. What I suggested can get 100% of the desi=
red behavior. As such, there is no <i>need</i> to have a language solution,=
 since we can get the same thing through the library.<br><br>Not only that,=
 we can do so much better with a library-based solution:<br><br><div style=
=3D"border: 1px solid rgb(187, 187, 187); border-image: none; background-co=
lor: rgb(250, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);"=
>for</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"=
color: rgb(0, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);"> i<=
/span><span style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color=
: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">20rng</sp=
an><span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: r=
gb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">{}</span><sp=
an style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0,=
 0);">//Counts on the range [0, 20)</span><span style=3D"color: rgb(0, 0, 0=
);"><br></span><span style=3D"color: rgb(0, 0, 136);">for</span><span style=
=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);=
">auto</span><span style=3D"color: rgb(0, 0, 0);"> i</span><span style=3D"c=
olor: rgb(102, 102, 0);">:</span><span style=3D"color: rgb(0, 0, 0);"> </sp=
an><span style=3D"color: rgb(0, 102, 102);">20revrng</span><span style=3D"c=
olor: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </sp=
an><span style=3D"color: rgb(102, 102, 0);">{}</span><span style=3D"color: =
rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">//Counts on t=
he range (20, 0]</span><span style=3D"color: rgb(0, 0, 0);"><br></span><spa=
n style=3D"color: rgb(0, 0, 136);">for</span><span style=3D"color: rgb(102,=
 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">auto</span><span =
style=3D"color: rgb(0, 0, 0);"> i</span><span style=3D"color: rgb(102, 102,=
 0);">:</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"c=
olor: rgb(0, 102, 102);">4begin</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(102, 102, 0);">|</span><span style=3D"col=
or: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">43end</=
span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color:=
 rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">{}</span><=
span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, =
0, 0);">//Counts on the range [4, 43)</span><span style=3D"color: rgb(0, 0,=
 0);"><br></span><span style=3D"color: rgb(0, 0, 136);">for</span><span sty=
le=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136=
);">auto</span><span style=3D"color: rgb(0, 0, 0);"> i</span><span style=3D=
"color: rgb(102, 102, 0);">:</span><span style=3D"color: rgb(0, 0, 0);"> </=
span><span style=3D"color: rgb(0, 102, 102);">16begin</span><span style=3D"=
color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">|</s=
pan><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(=
0, 102, 102);">12end</span><span style=3D"color: rgb(102, 102, 0);">)</span=
><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102=
, 102, 0);">{}</span><span style=3D"color: rgb(0, 0, 0);"> </span><span sty=
le=3D"color: rgb(136, 0, 0);">//Counts on the range (16, 12]</span><span st=
yle=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(0, 0, 136=
);">for</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=
=3D"color: rgb(0, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);"=
> i</span><span style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"c=
olor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">20rng=
</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: r=
gb(102, 102, 0);">|</span><span style=3D"color: rgb(0, 0, 0);"> </span><spa=
n style=3D"color: rgb(0, 102, 102);">2step</span><span style=3D"color: rgb(=
102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </span><span s=
tyle=3D"color: rgb(102, 102, 0);">{}</span><span style=3D"color: rgb(0, 0, =
0);"> </span><span style=3D"color: rgb(136, 0, 0);">//Counts on the range [=
0, 20), in increments of 2</span></div></code></div></div></div></blockquot=
e><div><br></div><div>Really, you [ask] us to write this?</div></div></bloc=
kquote><div><br>I&#39;m sorry, I don&#39;t understand what you were trying =
to say. If you&#39;re saying that we shouldn&#39;t have something like `10r=
ng` as shorthand for &quot;an integer range from 0 to 10&quot;, what&#39;s =
wrong with that?<br></div></div></blockquote><div><br></div><div>Well, &quo=
t;rng&quot; is an abbreviation for &quot;random number generator&quot;, for=
 one. ;)</div><div>But I don&#39;t think Nicol is [or needs to be] arguing =
that we should <i>standardize</i> the UDL suffixes &quot;rng&quot; or &quot=
;begin&quot; or &quot;end&quot; or &quot;step&quot; or &quot;revrng&quot;. =
The core point here seems to be [or should be] that Abdulla could go home r=
ight now and write those UDLs <i>himself</i>, and then he wouldn&#39;t desi=
re a core language change anymore, because he&#39;d have something just as =
useful and in fact infinitely more expressive and flexible, and also he cou=
ld use it in C++11 today instead of only in C++20 tomorrow.<br></div></div>=
</blockquote><div><br>The point I&#39;m making is not so much that you coul=
d do it yourself; after all, you could implement std::vector yourself (exce=
pt that you can&#39;t, but that&#39;s another matter), but that&#39;s not a=
n argument not to have it in the standard library. My main point is that, i=
f there is a need for C++ to provide the ability to loop over numbers more =
easily, then a library solution would have negligible downsides compared to=
 a language solution. And therefore, the library solution should be preferr=
ed.<br><br>Personally, I think this is something the standard library ought=
 to provide, though the UDL suffixes might be a bit much. But I swear by my=
 `_z` suffix; it&#39;s absolutely essential for looping over unsigned integ=
ers.</div></div></blockquote></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/eab780da-c6ef-44aa-adc9-606231dfbcb0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/eab780da-c6ef-44aa-adc9-606231dfbcb0=
%40isocpp.org</a>.<br />

------=_Part_1723_934168662.1499429330419--

------=_Part_1722_184526921.1499429330418--

.