Topic: Is it necessary to add a stronger keyword than `const`?
Author: zhouhongyu1104@gmail.com
Date: Tue, 7 Aug 2018 14:52:42 -0700 (PDT)
Raw View
------=_Part_2012_1247797281.1533678762371
Content-Type: multipart/alternative;
boundary="----=_Part_2013_676564869.1533678762371"
------=_Part_2013_676564869.1533678762371
Content-Type: text/plain; charset="UTF-8"
*const* can only prohibit modifying members. Is it necessary to add a
keyword, such as *blind*, to prohibit member variable access (except *this*),
because sometimes some methods need to be inherited by subclasses, but
these methods should remain stateless.
For example, if you have a long and long member method, it takes a lot of
time to determine if it has modified any member variables. Of course, it
can be a static method, but there is no way to override it when using
polymorphism.
--
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/6e5d4159-0acf-4fb7-825a-40eb1540fb2d%40isocpp.org.
------=_Part_2013_676564869.1533678762371
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><code style=3D"box-sizing: border-box; font-family: SFMono=
-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;=
font-size: 12px; padding: 0.2em 0.4em; background-color: rgba(27, 31, 35, =
0.05); border-radius: 3px; color: rgb(36, 41, 46);"><b>const</b></code><spa=
n style=3D"color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSyst=
emFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Col=
or Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; fo=
nt-size: 14px;">=C2=A0can only prohibit modifying members. Is it necessary =
to add a keyword, such as=C2=A0</span><code style=3D"box-sizing: border-box=
; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo=
, Courier, monospace; font-size: 12px; padding: 0.2em 0.4em; background-col=
or: rgba(27, 31, 35, 0.05); border-radius: 3px; color: rgb(36, 41, 46);"><b=
>blind</b></code><span style=3D"color: rgb(36, 41, 46); font-family: -apple=
-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-s=
erif, "Apple Color Emoji", "Segoe UI Emoji", "Sego=
e UI Symbol"; font-size: 14px;">, to prohibit member variable access (=
except=C2=A0</span><code style=3D"box-sizing: border-box; font-family: SFMo=
no-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospac=
e; font-size: 12px; padding: 0.2em 0.4em; background-color: rgba(27, 31, 35=
, 0.05); border-radius: 3px; color: rgb(36, 41, 46);"><b>this</b></code><sp=
an style=3D"color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSys=
temFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Co=
lor Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; f=
ont-size: 14px;">), because sometimes some methods need to be inherited by =
subclasses, but these methods should remain stateless.</span><br><div><span=
style=3D"color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSyste=
mFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Colo=
r Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; fon=
t-size: 14px;"><br></span></div><div><font color=3D"#24292e" face=3D"-apple=
-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple =
Color Emoji, Segoe UI Emoji, Segoe UI Symbol"><span style=3D"font-size: 14p=
x;">For example, if you have a long and long member method, it takes a lot =
of time to determine if it has modified any member variables. Of course, it=
can be a static method, but there is no way to override it when using poly=
morphism.</span></font><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/6e5d4159-0acf-4fb7-825a-40eb1540fb2d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6e5d4159-0acf-4fb7-825a-40eb1540fb2d=
%40isocpp.org</a>.<br />
------=_Part_2013_676564869.1533678762371--
------=_Part_2012_1247797281.1533678762371--
.
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Tue, 7 Aug 2018 17:14:38 -0700 (PDT)
Raw View
------=_Part_2058_1490114562.1533687278444
Content-Type: multipart/alternative;
boundary="----=_Part_2059_1363788366.1533687278444"
------=_Part_2059_1363788366.1533687278444
Content-Type: text/plain; charset="UTF-8"
On Tuesday, August 7, 2018 at 2:52:42 PM UTC-7, zhouhon...@gmail.com wrote:
>
> *const* can only prohibit modifying members. Is it necessary to add a
> keyword, such as *blind*, to prohibit member variable access (except
> *this*), because sometimes some methods need to be inherited by
> subclasses, but these methods should remain stateless.
>
> For example, if you have a long and long member method, it takes a lot of
> time to determine if it has modified any member variables. Of course, it
> can be a static method, but there is no way to override it when using
> polymorphism.
>
It sounds like you want static, and your only objection to it is that
static methods can't be virtual at the same time.
See "static virtual member functions," as discussed previously in this
forum e.g.
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/O-7FHl4R--Q/ITeFwVuUFwAJ
I don't think anyone is actively pursuing the idea (nor static virtual data
members) at the moment. But it definitely seems like well-thought-out and
well-trodden ground, compared to some kind of "blind" cv-qualifier that
would apply only to member functions.
HTH,
Arthur
--
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/75e6c7b2-bce3-4ed8-8711-5c6b3c1ce1bb%40isocpp.org.
------=_Part_2059_1363788366.1533687278444
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tuesday, August 7, 2018 at 2:52:42 PM UTC-7, zhouhon...=
@gmail.com wrote:<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"><code style=3D"font-family:SFMono-Regular,Consolas,"Liberation Mon=
o",Menlo,Courier,monospace;font-size:12px;padding:0.2em 0.4em;backgrou=
nd-color:rgba(27,31,35,0.05);border-radius:3px;color:rgb(36,41,46)"><b>cons=
t</b></code><span style=3D"color:rgb(36,41,46);font-family:-apple-system,Bl=
inkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Appl=
e Color Emoji","Segoe UI Emoji","Segoe UI Symbol";=
font-size:14px">=C2=A0can only prohibit modifying members. Is it necessary =
to add a keyword, such as=C2=A0</span><code style=3D"font-family:SFMono-Reg=
ular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size=
:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0.05);border-radiu=
s:3px;color:rgb(36,41,46)"><b>blind</b></code><span style=3D"color:rgb(36,4=
1,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Hel=
vetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji&=
quot;,"Segoe UI Symbol";font-size:14px">, to prohibit member vari=
able access (except=C2=A0</span><code style=3D"font-family:SFMono-Regular,C=
onsolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;=
padding:0.2em 0.4em;background-color:rgba(27,31,35,0.05);border-radius:3px;=
color:rgb(36,41,46)"><b>this</b></code><span style=3D"color:rgb(36,41,46);f=
ont-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,=
Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",&=
quot;Segoe UI Symbol";font-size:14px">), because sometimes some method=
s need to be inherited by subclasses, but these methods should remain state=
less.</span><br><div><span style=3D"color:rgb(36,41,46);font-family:-apple-=
system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,&=
quot;Apple Color Emoji","Segoe UI Emoji","Segoe UI Symb=
ol";font-size:14px"><br></span></div><div><font color=3D"#24292e" face=
=3D"-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-ser=
if, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol"><span style=3D"font=
-size:14px">For example, if you have a long and long member method, it take=
s a lot of time to determine if it has modified any member variables. Of co=
urse, it can be a static method, but there is no way to override it when us=
ing polymorphism.</span></font></div></div></blockquote><div><br></div><div=
>It sounds like you want <font face=3D"courier new, monospace">static</font=
>, and your only objection to it is that static methods can't be virtua=
l at the same time.</div><div>See "<font face=3D"courier new, monospac=
e">static virtual</font> member functions," as discussed previously in=
this forum e.g.</div><div><a href=3D"https://groups.google.com/a/isocpp.or=
g/d/msg/std-proposals/O-7FHl4R--Q/ITeFwVuUFwAJ">https://groups.google.com/a=
/isocpp.org/d/msg/std-proposals/O-7FHl4R--Q/ITeFwVuUFwAJ</a></div><div><br>=
</div><div>I don't think anyone is actively pursuing the idea (nor <fon=
t face=3D"courier new, monospace">static virtual</font> data members) at th=
e moment. But it definitely seems like well-thought-out and well-trodden gr=
ound, compared to some kind of "blind" cv-qualifier that would ap=
ply only to member functions.</div><div><br></div><div>HTH,</div><div>Arthu=
r</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/75e6c7b2-bce3-4ed8-8711-5c6b3c1ce1bb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/75e6c7b2-bce3-4ed8-8711-5c6b3c1ce1bb=
%40isocpp.org</a>.<br />
------=_Part_2059_1363788366.1533687278444--
------=_Part_2058_1490114562.1533687278444--
.
Author: Vishal Oza <vickoza@gmail.com>
Date: Tue, 7 Aug 2018 17:23:36 -0700 (PDT)
Raw View
------=_Part_2208_1788554892.1533687816183
Content-Type: multipart/alternative;
boundary="----=_Part_2209_1006053854.1533687816183"
------=_Part_2209_1006053854.1533687816183
Content-Type: text/plain; charset="UTF-8"
I think I would like to have a different behavior then const. I would like
the keyword to set the variable as a constant during the lifetime of the
object like readonly.
On Tuesday, August 7, 2018 at 4:52:42 PM UTC-5, zhouhon...@gmail.com wrote:
>
> *const* can only prohibit modifying members. Is it necessary to add a
> keyword, such as *blind*, to prohibit member variable access (except
> *this*), because sometimes some methods need to be inherited by
> subclasses, but these methods should remain stateless.
>
> For example, if you have a long and long member method, it takes a lot of
> time to determine if it has modified any member variables. Of course, it
> can be a static method, but there is no way to override it when using
> polymorphism.
>
--
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/6fcc94b3-ddf0-4f43-bbbb-52ae8a060c30%40isocpp.org.
------=_Part_2209_1006053854.1533687816183
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I think I would like to have a different behavior=C2=A0the=
n const. I would like the keyword to set the variable as a constant during =
the lifetime of the object like readonly.<br><br><br><br>On Tuesday, August=
7, 2018 at 4:52:42 PM UTC-5, zhouhon...@gmail.com wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><code style=3D"font-family:SFM=
ono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;fo=
nt-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0.05);borde=
r-radius:3px;color:rgb(36,41,46)"><b>const</b></code><span style=3D"color:r=
gb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI&qu=
ot;,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI=
Emoji","Segoe UI Symbol";font-size:14px">=C2=A0can only pro=
hibit modifying members. Is it necessary to add a keyword, such as=C2=A0</s=
pan><code style=3D"font-family:SFMono-Regular,Consolas,"Liberation Mon=
o",Menlo,Courier,monospace;font-size:12px;padding:0.2em 0.4em;backgrou=
nd-color:rgba(27,31,35,0.05);border-radius:3px;color:rgb(36,41,46)"><b>blin=
d</b></code><span style=3D"color:rgb(36,41,46);font-family:-apple-system,Bl=
inkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Appl=
e Color Emoji","Segoe UI Emoji","Segoe UI Symbol";=
font-size:14px">, to prohibit member variable access (except=C2=A0</span><c=
ode style=3D"font-family:SFMono-Regular,Consolas,"Liberation Mono"=
;,Menlo,Courier,monospace;font-size:12px;padding:0.2em 0.4em;background-col=
or:rgba(27,31,35,0.05);border-radius:3px;color:rgb(36,41,46)"><b>this</b></=
code><span style=3D"color:rgb(36,41,46);font-family:-apple-system,BlinkMacS=
ystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color=
Emoji","Segoe UI Emoji","Segoe UI Symbol";font-si=
ze:14px">), because sometimes some methods need to be inherited by subclass=
es, but these methods should remain stateless.</span><br><div><span style=
=3D"color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"=
Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji",&qu=
ot;Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><br></s=
pan></div><div><font color=3D"#24292e" face=3D"-apple-system, BlinkMacSyste=
mFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI =
Emoji, Segoe UI Symbol"><span style=3D"font-size:14px">For example, if you =
have a long and long member method, it takes a lot of time to determine if =
it has modified any member variables. Of course, it can be a static method,=
but there is no way to override it when using polymorphism.</span></font><=
br></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" 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/6fcc94b3-ddf0-4f43-bbbb-52ae8a060c30%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6fcc94b3-ddf0-4f43-bbbb-52ae8a060c30=
%40isocpp.org</a>.<br />
------=_Part_2209_1006053854.1533687816183--
------=_Part_2208_1788554892.1533687816183--
.
Author: inkwizytoryankes@gmail.com
Date: Wed, 8 Aug 2018 16:18:29 -0700 (PDT)
Raw View
------=_Part_94_377592990.1533770309095
Content-Type: multipart/alternative;
boundary="----=_Part_95_587415800.1533770309095"
------=_Part_95_587415800.1533770309095
Content-Type: text/plain; charset="UTF-8"
Why not attribute? You only need forbid some code usage.
If you write code using this attribute on compiler that not support it you
still can write correct code but you will not be corrected if you make
mistaken.
Then you only need someone else compiler or static analyzer to verify if
this attribute is used correctly (e.g when you push commit to repo).
On Tuesday, August 7, 2018 at 11:52:42 PM UTC+2, zhouhon...@gmail.com wrote:
>
> *const* can only prohibit modifying members. Is it necessary to add a
> keyword, such as *blind*, to prohibit member variable access (except
> *this*), because sometimes some methods need to be inherited by
> subclasses, but these methods should remain stateless.
>
> For example, if you have a long and long member method, it takes a lot of
> time to determine if it has modified any member variables. Of course, it
> can be a static method, but there is no way to override it when using
> polymorphism.
>
--
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/47fa7bc5-ddeb-44fb-86ee-fd384ab513a6%40isocpp.org.
------=_Part_95_587415800.1533770309095
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Why not attribute? You only need forbid some code usa=
ge.</div><div>If you write code using this attribute on compiler that not s=
upport it you still can write correct code but you will not be corrected if=
you make mistaken.</div><div> Then you only need someone else compiler or =
static analyzer to verify if this attribute is used correctly (e.g when you=
push commit to repo).</div><br>On Tuesday, August 7, 2018 at 11:52:42 PM U=
TC+2, zhouhon...@gmail.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"><code style=3D"font-family:SFMono-Regular,Consolas,&quo=
t;Liberation Mono",Menlo,Courier,monospace;font-size:12px;padding:0.2e=
m 0.4em;background-color:rgba(27,31,35,0.05);border-radius:3px;color:rgb(36=
,41,46)"><b>const</b></code><span style=3D"color:rgb(36,41,46);font-family:=
-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-=
serif,"Apple Color Emoji","Segoe UI Emoji","Segoe =
UI Symbol";font-size:14px">=C2=A0can only prohibit modifying members. =
Is it necessary to add a keyword, such as=C2=A0</span><code style=3D"font-f=
amily:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,mon=
ospace;font-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0.=
05);border-radius:3px;color:rgb(36,41,46)"><b>blind</b></code><span style=
=3D"color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"=
Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji",&qu=
ot;Segoe UI Emoji","Segoe UI Symbol";font-size:14px">, to pr=
ohibit member variable access (except=C2=A0</span><code style=3D"font-famil=
y:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospa=
ce;font-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0.05);=
border-radius:3px;color:rgb(36,41,46)"><b>this</b></code><span style=3D"col=
or:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe U=
I",Helvetica,Arial,sans-serif,"Apple Color Emoji","Sego=
e UI Emoji","Segoe UI Symbol";font-size:14px">), because som=
etimes some methods need to be inherited by subclasses, but these methods s=
hould remain stateless.</span><br><div><span style=3D"color:rgb(36,41,46);f=
ont-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,=
Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",&=
quot;Segoe UI Symbol";font-size:14px"><br></span></div><div><font face=
=3D"-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-ser=
if, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" color=3D"#24292e"><=
span style=3D"font-size:14px">For example, if you have a long and long memb=
er method, it takes a lot of time to determine if it has modified any membe=
r variables. Of course, it can be a static method, but there is no way to o=
verride it when using polymorphism.</span></font><br></div></div></blockquo=
te></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/47fa7bc5-ddeb-44fb-86ee-fd384ab513a6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/47fa7bc5-ddeb-44fb-86ee-fd384ab513a6=
%40isocpp.org</a>.<br />
------=_Part_95_587415800.1533770309095--
------=_Part_94_377592990.1533770309095--
.
Author: Greg Marr <gregmmarr@gmail.com>
Date: Thu, 9 Aug 2018 10:11:01 -0700 (PDT)
Raw View
------=_Part_428_1788079437.1533834661939
Content-Type: multipart/alternative;
boundary="----=_Part_429_1750120898.1533834661940"
------=_Part_429_1750120898.1533834661940
Content-Type: text/plain; charset="UTF-8"
On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:
>
> I think I would like to have a different behavior then const. I would like
> the keyword to set the variable as a constant during the lifetime of the
> object like readonly.
>
How is that different than const?
--
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/bffe7e2a-56cb-4b7f-8a83-a35caa0a439b%40isocpp.org.
------=_Part_429_1750120898.1533834661940
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza=
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">I thin=
k I would like to have a different behavior=C2=A0then const. I would like t=
he keyword to set the variable as a constant during the lifetime of the obj=
ect like readonly.<br></div></blockquote><div><br></div><div>How is that di=
fferent than const?</div><div><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/bffe7e2a-56cb-4b7f-8a83-a35caa0a439b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/bffe7e2a-56cb-4b7f-8a83-a35caa0a439b=
%40isocpp.org</a>.<br />
------=_Part_429_1750120898.1533834661940--
------=_Part_428_1788079437.1533834661939--
.
Author: zhouhongyu1104@gmail.com
Date: Thu, 9 Aug 2018 22:30:37 -0700 (PDT)
Raw View
------=_Part_628_1064962428.1533879037557
Content-Type: multipart/alternative;
boundary="----=_Part_629_1588720548.1533879037557"
------=_Part_629_1588720548.1533879037557
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
=E5=9C=A8 2018=E5=B9=B48=E6=9C=8810=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=94 UTC=
+8=E4=B8=8A=E5=8D=881:11:02=EF=BC=8CGreg Marr=E5=86=99=E9=81=93=EF=BC=9A
>
> On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:
>>
>> I think I would like to have a different behavior then const. I would=20
>> like the keyword to set the variable as a constant during the lifetime o=
f=20
>> the object like readonly.
>>
>
> How is that different than const?
>
> sorry, i mean ' Tell other programmers not to rely on (including access)=
=20
any member variables '
--=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/e43a01c5-5935-4869-ba11-9d4eb242588e%40isocpp.or=
g.
------=_Part_629_1588720548.1533879037557
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>=E5=9C=A8 2018=E5=B9=B48=E6=9C=8810=E6=97=A5=E6=98=
=9F=E6=9C=9F=E4=BA=94 UTC+8=E4=B8=8A=E5=8D=881:11:02=EF=BC=8CGreg Marr=E5=
=86=99=E9=81=93=EF=BC=9A<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr">On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote=
:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I think I would l=
ike to have a different behavior=C2=A0then const. I would like the keyword =
to set the variable as a constant during the lifetime of the object like re=
adonly.<br></div></blockquote><div><br></div><div>How is that different tha=
n const?</div><div><br></div></div></blockquote><div>sorry, i mean=C2=A0 &#=
39; Tell other programmers not to rely on (including access) any member var=
iables '</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/e43a01c5-5935-4869-ba11-9d4eb242588e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e43a01c5-5935-4869-ba11-9d4eb242588e=
%40isocpp.org</a>.<br />
------=_Part_629_1588720548.1533879037557--
------=_Part_628_1064962428.1533879037557--
.
Author: zhouhongyu1104@gmail.com
Date: Thu, 9 Aug 2018 22:38:03 -0700 (PDT)
Raw View
------=_Part_659_463568043.1533879483251
Content-Type: multipart/alternative;
boundary="----=_Part_660_1719754562.1533879483251"
------=_Part_660_1719754562.1533879483251
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
=E5=9C=A8 2018=E5=B9=B48=E6=9C=888=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89 UTC+=
8=E4=B8=8A=E5=8D=885:52:42=EF=BC=8Czhouhon...@gmail.com=E5=86=99=E9=81=93=
=EF=BC=9A
>
> *const* can only prohibit modifying members. Is it necessary to add a=20
> keyword, such as *blind*, to prohibit member variable access (except=20
> *this*), because sometimes some methods need to be inherited by=20
> subclasses, but these methods should remain stateless.
>
> For example, if you have a long and long member method, it takes a lot of=
=20
> time to determine if it has modified or accessed any member variables. Of=
=20
> course, it can be a static method, but there is no way to override it whe=
n=20
> using polymorphism.
>
Tell other programmers that this method can't rely on (including accessing)=
=20
any member variables, just like ordinary functions or static functions, but=
=20
this function can be used inherited, so they can be guaranteed that this=20
function is stateless.
--=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/173c5a6d-5b9e-4cd3-abee-bed7e53f06e0%40isocpp.or=
g.
------=_Part_660_1719754562.1533879483251
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>=E5=9C=A8 2018=E5=B9=B48=E6=9C=888=E6=97=A5=E6=98=
=9F=E6=9C=9F=E4=B8=89 UTC+8=E4=B8=8A=E5=8D=885:52:42=EF=BC=8Czhouhon...@gma=
il.com=E5=86=99=E9=81=93=EF=BC=9A<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"><code style=3D"font-family:SFMono-Regular,Consolas,&quo=
t;Liberation Mono",Menlo,Courier,monospace;font-size:12px;padding:0.2e=
m 0.4em;background-color:rgba(27,31,35,0.05);border-radius:3px;color:rgb(36=
,41,46)"><b>const</b></code><span style=3D"color:rgb(36,41,46);font-family:=
-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-=
serif,"Apple Color Emoji","Segoe UI Emoji","Segoe =
UI Symbol";font-size:14px">=C2=A0can only prohibit modifying members. =
Is it necessary to add a keyword, such as=C2=A0</span><code style=3D"font-f=
amily:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,mon=
ospace;font-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0.=
05);border-radius:3px;color:rgb(36,41,46)"><b>blind</b></code><span style=
=3D"color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"=
Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji",&qu=
ot;Segoe UI Emoji","Segoe UI Symbol";font-size:14px">, to pr=
ohibit member variable access (except=C2=A0</span><code style=3D"font-famil=
y:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospa=
ce;font-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0.05);=
border-radius:3px;color:rgb(36,41,46)"><b>this</b></code><span style=3D"col=
or:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe U=
I",Helvetica,Arial,sans-serif,"Apple Color Emoji","Sego=
e UI Emoji","Segoe UI Symbol";font-size:14px">), because som=
etimes some methods need to be inherited by subclasses, but these methods s=
hould remain stateless.</span><br><div><span style=3D"color:rgb(36,41,46);f=
ont-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,=
Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",&=
quot;Segoe UI Symbol";font-size:14px"><br></span></div><div><font colo=
r=3D"#24292e" face=3D"-apple-system, BlinkMacSystemFont, Segoe UI, Helvetic=
a, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol"><=
span style=3D"font-size:14px">For example, if you have a long and long memb=
er method, it takes a lot of time to determine if it has modified or access=
ed any member variables. Of course, it can be a static method, but there is=
no way to override it when using polymorphism.</span></font></div></div></=
blockquote><div><br></div><div>Tell other programmers that this method can&=
#39;t rely on (including accessing) any member variables, just like ordinar=
y functions or static functions, but this function can be used inherited, s=
o they can be guaranteed that this function is stateless.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/173c5a6d-5b9e-4cd3-abee-bed7e53f06e0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/173c5a6d-5b9e-4cd3-abee-bed7e53f06e0=
%40isocpp.org</a>.<br />
------=_Part_660_1719754562.1533879483251--
------=_Part_659_463568043.1533879483251--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 10 Aug 2018 07:12:57 -0700 (PDT)
Raw View
------=_Part_751_1555923246.1533910378021
Content-Type: multipart/alternative;
boundary="----=_Part_752_1323398706.1533910378021"
------=_Part_752_1323398706.1533910378021
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Friday, August 10, 2018 at 1:38:03 AM UTC-4, zhouhon...@gmail.com wrote:
>
>
>
> =E5=9C=A8 2018=E5=B9=B48=E6=9C=888=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89 UT=
C+8=E4=B8=8A=E5=8D=885:52:42=EF=BC=8Czhouhon...@gmail.com=E5=86=99=E9=81=93=
=EF=BC=9A
>>
>> *const* can only prohibit modifying members. Is it necessary to add a=20
>> keyword, such as *blind*, to prohibit member variable access (except=20
>> *this*), because sometimes some methods need to be inherited by=20
>> subclasses, but these methods should remain stateless.
>>
>> For example, if you have a long and long member method, it takes a lot o=
f=20
>> time to determine if it has modified or accessed any member variables. O=
f=20
>> course, it can be a static method, but there is no way to override it wh=
en=20
>> using polymorphism.
>>
>
> Tell other programmers that this method can't rely on (including=20
> accessing) any member variables, just like ordinary functions or static=
=20
> functions, but this function can be used inherited, so they can be=20
> guaranteed that this function is stateless.
>
Such a function never uses or depends on `this`. So why don't you just=20
declare it `static`? You know that you can call static members with=20
`variable.name()` syntax, right? Also, `static` functions are inherited, so=
=20
it's not like you're losing anything. And since such functions cannot=20
depend on `this`, such functions cannot be `virtual`. Just like `static`=20
functions.
Also, this guarantees nothing about the statelessness of the function. It=
=20
can still access global variables/functions or member variables obtained=20
through its obvious parameters.
--=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/b084a3d2-e82c-42dc-8f45-f5c154201423%40isocpp.or=
g.
------=_Part_752_1323398706.1533910378021
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Friday, August 10, 2018 at 1:38:03 AM UTC-4, zh=
ouhon...@gmail.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"><br><br>=E5=9C=A8 2018=E5=B9=B48=E6=9C=888=E6=97=A5=E6=98=9F=E6=
=9C=9F=E4=B8=89 UTC+8=E4=B8=8A=E5=8D=885:52:42=EF=BC=8C<a>zhouhon...@<wbr>g=
mail.com</a>=E5=86=99=E9=81=93=EF=BC=9A<blockquote class=3D"gmail_quote" st=
yle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><code style=3D"font-family:SFMono-Regular,Consolas,&qu=
ot;Liberation Mono",Menlo,Courier,monospace;font-size:12px;padding:0.2=
em 0.4em;background-color:rgba(27,31,35,0.05);border-radius:3px;color:rgb(3=
6,41,46)"><b>const</b></code><span style=3D"color:rgb(36,41,46);font-family=
:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans=
-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe=
UI Symbol";font-size:14px">=C2=A0can only prohibit modifying members.=
Is it necessary to add a keyword, such as=C2=A0</span><code style=3D"font-=
family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,mo=
nospace;font-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0=
..05);border-radius:3px;color:rgb(36,41,46)"><b>blind</b></code><span style=
=3D"color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"=
Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji",&qu=
ot;Segoe UI Emoji","Segoe UI Symbol";font-size:14px">, to pr=
ohibit member variable access (except=C2=A0</span><code style=3D"font-famil=
y:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospa=
ce;font-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,35,0.05);=
border-radius:3px;color:rgb(36,41,46)"><b>this</b></code><span style=3D"col=
or:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe U=
I",Helvetica,Arial,sans-serif,"Apple Color Emoji","Sego=
e UI Emoji","Segoe UI Symbol";font-size:14px">), because som=
etimes some methods need to be inherited by subclasses, but these methods s=
hould remain stateless.</span><br><div><span style=3D"color:rgb(36,41,46);f=
ont-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,=
Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",&=
quot;Segoe UI Symbol";font-size:14px"><br></span></div><div><font face=
=3D"-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-ser=
if, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" color=3D"#24292e"><=
span style=3D"font-size:14px">For example, if you have a long and long memb=
er method, it takes a lot of time to determine if it has modified or access=
ed any member variables. Of course, it can be a static method, but there is=
no way to override it when using polymorphism.</span></font></div></div></=
blockquote><div><br></div><div>Tell other programmers that this method can&=
#39;t rely on (including accessing) any member variables, just like ordinar=
y functions or static functions, but this function can be used inherited, s=
o they can be guaranteed that this function is stateless.</div></div></bloc=
kquote><div><br></div>Such a function never uses or depends on `this`. So w=
hy don't you just declare it `static`? You know that you can call stati=
c members with `variable.name()` syntax, right? Also, `static` functions ar=
e inherited, so it's not like you're losing anything. And since suc=
h functions cannot depend on `this`, such functions cannot be `virtual`. Ju=
st like `static` functions.<br><div><br></div><div>Also, this guarantees no=
thing about the statelessness of the function. It can still access global v=
ariables/functions or member variables obtained through its obvious paramet=
ers.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/b084a3d2-e82c-42dc-8f45-f5c154201423%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b084a3d2-e82c-42dc-8f45-f5c154201423=
%40isocpp.org</a>.<br />
------=_Part_752_1323398706.1533910378021--
------=_Part_751_1555923246.1533910378021--
.
Author: zhouhongyu1104@gmail.com
Date: Fri, 10 Aug 2018 11:19:49 -0700 (PDT)
Raw View
------=_Part_938_1777272922.1533925189663
Content-Type: multipart/alternative;
boundary="----=_Part_939_1567904708.1533925189663"
------=_Part_939_1567904708.1533925189663
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Thank you for your reply. Someone mentioned virtual static, this is exactly=
=20
what I want to express. I want to use inheritable static methods in=20
polymorphism.
=E5=9C=A8 2018=E5=B9=B48=E6=9C=8810=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=94 UTC=
+8=E4=B8=8B=E5=8D=8810:12:58=EF=BC=8CNicol Bolas=E5=86=99=E9=81=93=EF=BC=9A
>
>
>
> On Friday, August 10, 2018 at 1:38:03 AM UTC-4, zhouhon...@gmail.com=20
> wrote:
>>
>>
>>
>> =E5=9C=A8 2018=E5=B9=B48=E6=9C=888=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89 U=
TC+8=E4=B8=8A=E5=8D=885:52:42=EF=BC=8Czhouhon...@gmail.com=E5=86=99=E9=81=
=93=EF=BC=9A
>>>
>>> *const* can only prohibit modifying members. Is it necessary to add a=
=20
>>> keyword, such as *blind*, to prohibit member variable access (except=20
>>> *this*), because sometimes some methods need to be inherited by=20
>>> subclasses, but these methods should remain stateless.
>>>
>>> For example, if you have a long and long member method, it takes a lot=
=20
>>> of time to determine if it has modified or accessed any member variable=
s.=20
>>> Of course, it can be a static method, but there is no way to override i=
t=20
>>> when using polymorphism.
>>>
>>
>> Tell other programmers that this method can't rely on (including=20
>> accessing) any member variables, just like ordinary functions or static=
=20
>> functions, but this function can be used inherited, so they can be=20
>> guaranteed that this function is stateless.
>>
>
> Such a function never uses or depends on `this`. So why don't you just=20
> declare it `static`? You know that you can call static members with `
> variable.name()` syntax, right? Also, `static` functions are inherited,=
=20
> so it's not like you're losing anything. And since such functions cannot=
=20
> depend on `this`, such functions cannot be `virtual`. Just like `static`=
=20
> functions.
>
> Also, this guarantees nothing about the statelessness of the function. It=
=20
> can still access global variables/functions or member variables obtained=
=20
> through its obvious parameters.
>
--=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/dbfac93a-8b8c-430b-ba48-9512bb07dcad%40isocpp.or=
g.
------=_Part_939_1567904708.1533925189663
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thank you for your reply. Someone mentioned virtual static=
, this is exactly what I want to express. I want to use inheritable static =
methods in polymorphism.<br><br>=E5=9C=A8 2018=E5=B9=B48=E6=9C=8810=E6=97=
=A5=E6=98=9F=E6=9C=9F=E4=BA=94 UTC+8=E4=B8=8B=E5=8D=8810:12:58=EF=BC=8CNico=
l Bolas=E5=86=99=E9=81=93=EF=BC=9A<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"><br><br>On Friday, August 10, 2018 at 1:38:03 AM UTC=
-4, <a>zhouhon...@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" sty=
le=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1e=
x"><div dir=3D"ltr"><br><br>=E5=9C=A8 2018=E5=B9=B48=E6=9C=888=E6=97=A5=E6=
=98=9F=E6=9C=9F=E4=B8=89 UTC+8=E4=B8=8A=E5=8D=885:52:42=EF=BC=8C<a>zhouhon.=
...@<wbr>gmail.com</a>=E5=86=99=E9=81=93=EF=BC=9A<blockquote class=3D"gmail_=
quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddi=
ng-left:1ex"><div dir=3D"ltr"><code style=3D"font-family:SFMono-Regular,Con=
solas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;pa=
dding:0.2em 0.4em;background-color:rgba(27,31,35,0.05);border-radius:3px;co=
lor:rgb(36,41,46)"><b>const</b></code><span style=3D"color:rgb(36,41,46);fo=
nt-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,A=
rial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",&q=
uot;Segoe UI Symbol";font-size:14px">=C2=A0can only prohibit modifying=
members. Is it necessary to add a keyword, such as=C2=A0</span><code style=
=3D"font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,C=
ourier,monospace;font-size:12px;padding:0.2em 0.4em;background-color:rgba(2=
7,31,35,0.05);border-radius:3px;color:rgb(36,41,46)"><b>blind</b></code><sp=
an style=3D"color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFon=
t,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji&q=
uot;,"Segoe UI Emoji","Segoe UI Symbol";font-size:14px"=
>, to prohibit member variable access (except=C2=A0</span><code style=3D"fo=
nt-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier=
,monospace;font-size:12px;padding:0.2em 0.4em;background-color:rgba(27,31,3=
5,0.05);border-radius:3px;color:rgb(36,41,46)"><b>this</b></code><span styl=
e=3D"color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"=
;Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji",&q=
uot;Segoe UI Emoji","Segoe UI Symbol";font-size:14px">), bec=
ause sometimes some methods need to be inherited by subclasses, but these m=
ethods should remain stateless.</span><br><div><span style=3D"color:rgb(36,=
41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",He=
lvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji=
","Segoe UI Symbol";font-size:14px"><br></span></div><div><f=
ont face=3D"-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, =
sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" color=3D"#2=
4292e"><span style=3D"font-size:14px">For example, if you have a long and l=
ong member method, it takes a lot of time to determine if it has modified o=
r accessed any member variables. Of course, it can be a static method, but =
there is no way to override it when using polymorphism.</span></font></div>=
</div></blockquote><div><br></div><div>Tell other programmers that this met=
hod can't rely on (including accessing) any member variables, just like=
ordinary functions or static functions, but this function can be used inhe=
rited, so they can be guaranteed that this function is stateless.</div></di=
v></blockquote><div><br></div>Such a function never uses or depends on `thi=
s`. So why don't you just declare it `static`? You know that you can ca=
ll static members with `<a href=3D"http://variable.name" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?=
q\x3dhttp%3A%2F%2Fvariable.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOX=
ATJto9OHbLQ3cZ_j4E97LRXcQ';return true;" onclick=3D"this.href=3D'ht=
tp://www.google.com/url?q\x3dhttp%3A%2F%2Fvariable.name\x26sa\x3dD\x26sntz\=
x3d1\x26usg\x3dAFQjCNGOXATJto9OHbLQ3cZ_j4E97LRXcQ';return true;">variab=
le.name</a>()` syntax, right? Also, `static` functions are inherited, so it=
's not like you're losing anything. And since such functions cannot=
depend on `this`, such functions cannot be `virtual`. Just like `static` f=
unctions.<br><div><br></div><div>Also, this guarantees nothing about the st=
atelessness of the function. It can still access global variables/functions=
or member variables obtained through its obvious parameters.<br></div></di=
v></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/dbfac93a-8b8c-430b-ba48-9512bb07dcad%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/dbfac93a-8b8c-430b-ba48-9512bb07dcad=
%40isocpp.org</a>.<br />
------=_Part_939_1567904708.1533925189663--
------=_Part_938_1777272922.1533925189663--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 10 Aug 2018 12:17:05 -0700 (PDT)
Raw View
------=_Part_866_1954073646.1533928625388
Content-Type: multipart/alternative;
boundary="----=_Part_867_106777209.1533928625388"
------=_Part_867_106777209.1533928625388
Content-Type: text/plain; charset="UTF-8"
On Friday, August 10, 2018 at 2:19:49 PM UTC-4, zhouhon...@gmail.com wrote:
>
> Thank you for your reply. Someone mentioned virtual static, this is
> exactly what I want to express. I want to use inheritable static methods in
> polymorphism.
>
What would that mean? How would it be any different from a `virtual`,
non-static method? Do you just want to prevent yourself from accessing
members through `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/6c7202da-2a1c-4ee5-b547-2d4fc73017eb%40isocpp.org.
------=_Part_867_106777209.1533928625388
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Friday, August 10, 2018 at 2:19:49 PM UTC-4, zhouhon...=
@gmail.com wrote:<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">Thank you for your reply. Someone mentioned virtual static, this is exa=
ctly what I want to express. I want to use inheritable static methods in po=
lymorphism.<br></div></blockquote><div><br></div><div>What would that mean?=
How would it be any different from a `virtual`, non-static method? Do you =
just want to prevent yourself from accessing members through `this`?<br></d=
iv></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/6c7202da-2a1c-4ee5-b547-2d4fc73017eb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6c7202da-2a1c-4ee5-b547-2d4fc73017eb=
%40isocpp.org</a>.<br />
------=_Part_867_106777209.1533928625388--
------=_Part_866_1954073646.1533928625388--
.