Topic: New type of access modifier which allows


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 10 Jun 2015 13:21:39 -0500
Raw View
--001a1137f4d8a15fc105182df425
Content-Type: text/plain; charset=UTF-8

On 10 June 2015 at 13:06, Matthew Woehlke <mw_triad@users.sourceforge.net>
wrote:

>
>
It's not *exactly* between, since
> "stuff in the same namespace" is not a superset of "derived classes" (a
> class in namespace A can inherit from something in namespace B), but it
> is generally more broad than "protected" and certainly less broad than
> "public".
>

If it is less broad than public, please show an example with this feature
where one is restricted from calling, directly or indirectly,
MyClass::SetDependency().


> There are various ways in which I can call a private member if I really
> want to.


That are legal according to the C++ standard?  I know there is an
encapsulation hole with templated member functions, but how else can you do
it?
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a1137f4d8a15fc105182df425
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 10 June 2015 at 13:06, Matthew Woehlke <span dir=3D"ltr=
">&lt;<a href=3D"mailto:mw_triad@users.sourceforge.net" target=3D"_blank">m=
w_triad@users.sourceforge.net</a>&gt;</span> wrote:<br><div class=3D"gmail_=
extra"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">=C2=A0<b=
r></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex"> It&#39;s not *exactly* betwe=
en, since<br>
&quot;stuff in the same namespace&quot; is not a superset of &quot;derived =
classes&quot; (a<br>
class in namespace A can inherit from something in namespace B), but it<br>
is generally more broad than &quot;protected&quot; and certainly less broad=
 than<br>
&quot;public&quot;.<br></blockquote><div><br></div><div>If it is less broad=
 than public, please show an example with this feature where one is restric=
ted from calling, directly or indirectly, MyClass::SetDependency().</div><d=
iv>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex">There are various ways in whi=
ch I can call a private member if I really<br>
want to.</blockquote><div><br></div><div>That are legal according to the C+=
+ standard?=C2=A0 I know there is an encapsulation hole with templated memb=
er functions, but how else can you do it?</div></div>-- <br><div class=3D"g=
mail_signature">=C2=A0Nevin &quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=
=3D"mailto:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com=
</a>&gt;=C2=A0 (847) 691-1404</div>
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a1137f4d8a15fc105182df425--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 10 Jun 2015 15:50:13 -0500
Raw View
--001a11c3bad8eef0440518300731
Content-Type: text/plain; charset=UTF-8

On 10 June 2015 at 15:29, Matthew Woehlke <mw_triad@users.sourceforge.net>
wrote:

> On 2015-06-10 14:21, Nevin Liber wrote:
> > On 10 June 2015 at 13:06, Matthew Woehlke wrote:
> >> It's not *exactly* between, since
> >> "stuff in the same namespace" is not a superset of "derived classes" (a
> >> class in namespace A can inherit from something in namespace B), but it
> >> is generally more broad than "protected" and certainly less broad than
> >> "public".
> >
> > If it is less broad than public, please show an example with this feature
> > where one is restricted from calling, directly or indirectly,
> > MyClass::SetDependency().
>
> Really?
>
>   namespace A {
>     class Foo {
>       internal: void poke();
>     };
>   }
>
>   namespace B {
>     class Bar {
>       public: void prod();
>     }
>   }
>
>   void A::Foo::poke() {
>     poke(); // stack overflow (due to lazy example), but legal
>   }
>
>   void B::Bar::prod() {
>     A::Foo foo;
>     foo.poke(); // error: poke is internal
>   }
>
>   int main() {
>     A::Foo foo;
>     foo.poke(); // error: poke is internal
>   }
>

And then I just write the trivial:

namespace A { void poker(A& a) { a.poke(); } }

Rewriting your examples:

void B::Bar::prod() {
    A::Foo foo;
    A::poker(foo); // works fine
}

int main() {
    A::Foo foo;
    A::poker(foo); // works fine
}

You've prevented *nothing*.  I just have to jump through one hoop, which
can be just as easily implemented with a friend.


> >> There are various ways in which I can call a private member if I really
> >> want to.
> >
> > That are legal according to the C++ standard?  I know there is an
> > encapsulation hole with templated member functions, but how else can you
> do
> > it?
>
> I'm not sure how you define "legal".


Legal according to the C++ standard.  Does not result in an ill-formed
program, invoke undefined behavior, etc.


> There is of course '#define private
> public'.


That is not legal.


> You can redefine the class, adding your own custom member (or
> additional friends).


That is not legal.


> There are probably other ways...
>

That are legal?  You have yet to name *any*.

FYI: <http://www.gotw.ca/gotw/076.htm> describes why all the hacks you have
mentioned are illegal, as well as the issue with templates.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c3bad8eef0440518300731
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On 1=
0 June 2015 at 15:29, Matthew Woehlke <span dir=3D"ltr">&lt;<a href=3D"mail=
to:mw_triad@users.sourceforge.net" target=3D"_blank">mw_triad@users.sourcef=
orge.net</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(20=
4,204,204);border-left-style:solid;padding-left:1ex">On 2015-06-10 14:21, N=
evin Liber wrote:<br>
<span class=3D"">&gt; On 10 June 2015 at 13:06, Matthew Woehlke wrote:<br>
&gt;&gt; It&#39;s not *exactly* between, since<br>
&gt;&gt; &quot;stuff in the same namespace&quot; is not a superset of &quot=
;derived classes&quot; (a<br>
&gt;&gt; class in namespace A can inherit from something in namespace B), b=
ut it<br>
&gt;&gt; is generally more broad than &quot;protected&quot; and certainly l=
ess broad than<br>
&gt;&gt; &quot;public&quot;.<br>
&gt;<br>
&gt; If it is less broad than public, please show an example with this feat=
ure<br>
&gt; where one is restricted from calling, directly or indirectly,<br>
&gt; MyClass::SetDependency().<br>
<br>
</span>Really?<br>
<br>
=C2=A0 namespace A {<br>
=C2=A0 =C2=A0 class Foo {<br>
=C2=A0 =C2=A0 =C2=A0 internal: void poke();<br>
=C2=A0 =C2=A0 };<br>
=C2=A0 }<br>
<br>
=C2=A0 namespace B {<br>
=C2=A0 =C2=A0 class Bar {<br>
=C2=A0 =C2=A0 =C2=A0 public: void prod();<br>
=C2=A0 =C2=A0 }<br>
=C2=A0 }<br>
<br>
=C2=A0 void A::Foo::poke() {<br>
=C2=A0 =C2=A0 poke(); // stack overflow (due to lazy example), but legal<br=
>
=C2=A0 }<br>
<br>
=C2=A0 void B::Bar::prod() {<br>
=C2=A0 =C2=A0 A::Foo foo;<br>
=C2=A0 =C2=A0 foo.poke(); // error: poke is internal<br>
=C2=A0 }<br>
<br>
=C2=A0 int main() {<br>
=C2=A0 =C2=A0 A::Foo foo;<br>
=C2=A0 =C2=A0 foo.poke(); // error: poke is internal<br>
<span class=3D"">=C2=A0 }<br></span></blockquote><div><br></div><div>And th=
en I just write the trivial:</div><div><br></div><div>namespace A { void po=
ker(A&amp; a) { a.poke(); } }</div><div><br></div><div>Rewriting your examp=
les:</div><div><br></div><div>void B::Bar::prod() {</div><div>=C2=A0 =C2=A0=
 A::Foo foo;</div><div>=C2=A0 =C2=A0 A::poker(foo); // works fine</div><div=
>}</div><div><br></div><div>int main() {</div><div>=C2=A0 =C2=A0 A::Foo foo=
;</div><div>=C2=A0 =C2=A0 A::poker(foo); // works fine</div><div>}</div><di=
v><br></div><div>You&#39;ve prevented <i>nothing</i>.=C2=A0 I just have to =
jump through one hoop, which can be just as easily implemented with a frien=
d. =C2=A0</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,=
204);border-left-style:solid;padding-left:1ex"><span class=3D"">
<br>
&gt;&gt; There are various ways in which I can call a private member if I r=
eally<br>
&gt;&gt; want to.<br>
&gt;<br>
&gt; That are legal according to the C++ standard?=C2=A0 I know there is an=
<br>
&gt; encapsulation hole with templated member functions, but how else can y=
ou do<br>
&gt; it?<br>
<br>
</span>I&#39;m not sure how you define &quot;legal&quot;.</blockquote><div>=
<br></div><div>Legal according to the C++ standard.=C2=A0 Does not result i=
n an ill-formed program, invoke undefined behavior, etc.</div><div>=C2=A0</=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:sol=
id;padding-left:1ex"> There is of course &#39;#define private<br>
public&#39;. </blockquote><div><br></div><div>That is not legal.</div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
..8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-s=
tyle:solid;padding-left:1ex">You can redefine the class, adding your own cu=
stom member (or<br>
additional friends).</blockquote><div><br></div><div>That is not legal.</di=
v><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border=
-left-style:solid;padding-left:1ex"> There are probably other ways...<br></=
blockquote><div><br></div><div>That are legal?=C2=A0 You have yet to name <=
i>any</i>.</div><div><br></div><div>FYI: &lt;<a href=3D"http://www.gotw.ca/=
gotw/076.htm">http://www.gotw.ca/gotw/076.htm</a>&gt; describes why all the=
 hacks you have mentioned are illegal, as well as the issue with templates.=
</div></div>-- <br><div class=3D"gmail_signature">=C2=A0Nevin &quot;:-)&quo=
t; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=
=3D"_blank">nevin@eviloverlord.com</a>&gt;=C2=A0 (847) 691-1404</div>
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c3bad8eef0440518300731--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 10 Jun 2015 17:04:07 -0500
Raw View
--f46d043be0fc34e5e9051831106d
Content-Type: text/plain; charset=UTF-8

On 10 June 2015 at 16:48, Matthew Woehlke <mw_triad@users.sourceforge.net>
wrote:

> On 2015-06-10 16:50, Nevin Liber wrote:
> > On 10 June 2015 at 15:29, Matthew Woehlke wrote:
> >> On 2015-06-10 14:21, Nevin Liber wrote:
> >>> On 10 June 2015 at 13:06, Matthew Woehlke wrote:
> >>>> It's not *exactly* between, since
> >>>> "stuff in the same namespace" is not a superset of "derived classes"
> (a
> >>>> class in namespace A can inherit from something in namespace B), but
> it
> >>>> is generally more broad than "protected" and certainly less broad than
> >>>> "public".
> >>>
> >>> If it is less broad than public, please show an example with this
> feature
> >>> where one is restricted from calling, directly or indirectly,
> >>> MyClass::SetDependency().
> >>
> >> [snip example]
> >
> > And then I just write the trivial:
> >
> > [snip example bypassing access protection]
> >
> > You've prevented *nothing*.
>
> I've prevented you accessing it without consciously circumventing an
> access protection. That's... about equally secure as protected.
>

Protected is more restrictive.  Taking your example:

class Foo { protected: void poke(); };

int main()
{
    Foo f;
    // write the legal code which can call f.poke() here.
}


> Well, yes. Again, I didn't say I find the feature *sufficiently* useful
> (i.e. to be worth adding). I just disagree that it isn't *at all* useful.
>

Every idea has *a* use case, but so what?  It doesn't let me express
anything I cannot express now, nor does it make it any easier to express
it, so I don't see a point to it.  This provides nothing that friendship
cannot now provide *better*.

 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--f46d043be0fc34e5e9051831106d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On 1=
0 June 2015 at 16:48, Matthew Woehlke <span dir=3D"ltr">&lt;<a href=3D"mail=
to:mw_triad@users.sourceforge.net" target=3D"_blank">mw_triad@users.sourcef=
orge.net</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(20=
4,204,204);border-left-style:solid;padding-left:1ex">On 2015-06-10 16:50, N=
evin Liber wrote:<br>
<span class=3D"">&gt; On 10 June 2015 at 15:29, Matthew Woehlke wrote:<br>
&gt;&gt; On 2015-06-10 14:21, Nevin Liber wrote:<br>
&gt;&gt;&gt; On 10 June 2015 at 13:06, Matthew Woehlke wrote:<br>
&gt;&gt;&gt;&gt; It&#39;s not *exactly* between, since<br>
&gt;&gt;&gt;&gt; &quot;stuff in the same namespace&quot; is not a superset =
of &quot;derived classes&quot; (a<br>
&gt;&gt;&gt;&gt; class in namespace A can inherit from something in namespa=
ce B), but it<br>
&gt;&gt;&gt;&gt; is generally more broad than &quot;protected&quot; and cer=
tainly less broad than<br>
&gt;&gt;&gt;&gt; &quot;public&quot;.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; If it is less broad than public, please show an example with t=
his feature<br>
&gt;&gt;&gt; where one is restricted from calling, directly or indirectly,<=
br>
&gt;&gt;&gt; MyClass::SetDependency().<br>
&gt;&gt;<br>
</span>&gt;&gt; [snip example]<br>
<span class=3D"">&gt;<br>
&gt; And then I just write the trivial:<br>
&gt;<br>
</span>&gt; [snip example bypassing access protection]<br>
&gt;<br>
&gt; You&#39;ve prevented *nothing*.<br>
<br>
I&#39;ve prevented you accessing it without consciously circumventing an<br=
>
access protection. That&#39;s... about equally secure as protected.<br></bl=
ockquote><div><br></div><div>Protected is more restrictive.=C2=A0 Taking yo=
ur example:</div><div><br></div><div>class Foo { protected: void poke(); };=
</div><div><br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0 Fo=
o f;</div><div>=C2=A0 =C2=A0 // write the legal code which can call f.poke(=
) here.</div><div>}</div><div>=C2=A0</div><blockquote class=3D"gmail_quote"=
 style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:=
rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=3D""=
>
</span>Well, yes. Again, I didn&#39;t say I find the feature *sufficiently*=
 useful<br>
(i.e. to be worth adding). I just disagree that it isn&#39;t *at all* usefu=
l.<br></blockquote><div><br></div><div>Every idea has <i>a</i>=C2=A0use cas=
e, but so what?=C2=A0 It doesn&#39;t let me express anything I cannot expre=
ss now, nor does it make it any easier to express it, so I don&#39;t see a =
point to it.=C2=A0 This provides nothing that friendship cannot now provide=
 <i>better</i>.</div></div><br><div class=3D"gmail_signature">=C2=A0Nevin &=
quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.=
com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;=C2=A0 (847) 691-1404<=
/div>
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--f46d043be0fc34e5e9051831106d--

.


Author: Gina Stephens <zumbagina29@gmail.com>
Date: Wed, 10 Jun 2015 16:34:15 -0700 (PDT)
Raw View
------=_Part_13_830411248.1433979255988
Content-Type: multipart/alternative;
 boundary="----=_Part_14_225623283.1433979255988"

------=_Part_14_225623283.1433979255988
Content-Type: text/plain; charset=UTF-8


>
>
>>
> Protected is more restrictive.  Taking your example:
>
> class Foo { protected: void poke(); };
>
> int main()
> {
>     Foo f;
>     // write the legal code which can call f.poke() here.
> }
>
>
GMS - Now, if I want to design a class that can call poke, I need to either
declare my class as a friend OR subclass Foo, which both solutions creates
unnecessary coupling.  Even with the example given in which there is only 1
friend, I am STILL coupled to that friend.  The coupling is bad enough, but
think about if I have an application that builds for different platforms.
 My "friend" may not even be defined for the platform for which I am
building.  Then what?  "Friend" won't help in that case, however I can have
the same namespace defined for every platform and I can insert a
platform-specific definition.



> Well, yes. Again, I didn't say I find the feature *sufficiently* useful
>> (i.e. to be worth adding). I just disagree that it isn't *at all* useful.
>>
>
> Every idea has *a* use case, but so what?  It doesn't let me express
> anything I cannot express now, nor does it make it any easier to express
> it, so I don't see a point to it.  This provides nothing that friendship
> cannot now provide *better*.
>


GMS - Sorry, but I don't agree.  This feature is extremely useful and is
more expressive than 'friend'.  As I have said before, usage of friend is a
band-aid for poor design choices.  Think about every design pattern in
which an object 'registers' with another object (Publisher-Subscriber,
Dependency Injection, Visitor, and probably more that I can't think of
right now).  This feature would be useful in these cases.  It is all about
expressing meaning and intent in one's design and following good design
practices.

There is a reason that JAVA and C# have a feature like what I am
suggesting.  It's time for the C++ language to "catch up".

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_14_225623283.1433979255988
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><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><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(20=
4,204,204);border-left-style:solid;padding-left:1ex"><br></blockquote><div>=
<br></div><div>Protected is more restrictive.&nbsp; Taking your example:</d=
iv><div><br></div><div>class Foo { protected: void poke(); };</div><div><br=
></div><div>int main()</div><div>{</div><div>&nbsp; &nbsp; Foo f;</div><div=
>&nbsp; &nbsp; // write the legal code which can call f.poke() here.</div><=
div>}</div><div>&nbsp;</div></div></div></div></blockquote><div>GMS - Now, =
if I want to design a class that can call poke, I need to either declare my=
 class as a friend OR subclass Foo, which both solutions creates unnecessar=
y coupling. &nbsp;Even with the example given in which there is only 1 frie=
nd, I am STILL coupled to that friend. &nbsp;The coupling is bad enough, bu=
t think about if I have an application that builds for different platforms.=
 &nbsp;My "friend" may not even be defined for the platform for which I am =
building. &nbsp;Then what? &nbsp;"Friend" won't help in that case, however =
I can have the same namespace defined for every platform and I can insert a=
 platform-specific definition.</div><div><br></div><div>&nbsp;</div><blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div class=3D"gmail_=
quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:=
solid;padding-left:1ex"><span>
</span>Well, yes. Again, I didn't say I find the feature *sufficiently* use=
ful<br>
(i.e. to be worth adding). I just disagree that it isn't *at all* useful.<b=
r></blockquote><div><br></div><div>Every idea has <i>a</i>&nbsp;use case, b=
ut so what?&nbsp; It doesn't let me express anything I cannot express now, =
nor does it make it any easier to express it, so I don't see a point to it.=
&nbsp; This provides nothing that friendship cannot now provide <i>better</=
i>.</div></div></div></blockquote><div><br></div><div><br></div><div>GMS - =
Sorry, but I don't agree. &nbsp;This feature is extremely useful and is mor=
e expressive than 'friend'. &nbsp;As I have said before, usage of friend is=
 a band-aid for poor design choices. &nbsp;Think about every design pattern=
 in which an object 'registers' with another object (Publisher-Subscriber, =
Dependency Injection, Visitor, and probably more that I can't think of righ=
t now). &nbsp;This feature would be useful in these cases. &nbsp;It is all =
about expressing meaning and intent in one's design and following good desi=
gn practices.</div><div><br></div><div>There is a reason that JAVA and C# h=
ave a feature like what I am suggesting. &nbsp;It's time for the C++ langua=
ge to "catch up".</div><div><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_14_225623283.1433979255988--
------=_Part_13_830411248.1433979255988--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Thu, 11 Jun 2015 11:31:21 -0500
Raw View
--047d7bb03a9202acc10518408830
Content-Type: text/plain; charset=UTF-8

On 10 June 2015 at 18:34, Gina Stephens <zumbagina29@gmail.com> wrote:

>
>>>
>> Protected is more restrictive.  Taking your example:
>>
>> class Foo { protected: void poke(); };
>>
>> int main()
>> {
>>     Foo f;
>>     // write the legal code which can call f.poke() here.
>> }
>>
>>
> GMS - Now, if I want to design a class that can call poke, I need to
> either declare my class as a friend OR subclass Foo, which both solutions
> creates unnecessary coupling.  Even with the example given in which there
> is only 1 friend, I am STILL coupled to that friend.  The coupling is bad
> enough, but think about if I have an application that builds for different
> platforms.
>

I don't see why the coupling is bad.  The friend class is part of your
interface.


>  My "friend" may not even be defined for the platform for which I am
> building.  Then what?
>

I don't understand.  That's like asking "what if you don't have a
SetDependency call.  Then what?"

Either it is part of your interface and you provide it, or it isn't.


> GMS - Sorry, but I don't agree.  This feature is extremely useful and is
> more expressive than 'friend'.  As I have said before, usage of friend is a
> band-aid for poor design choices.  Think about every design pattern in
> which an object 'registers' with another object (Publisher-Subscriber,
> Dependency Injection, Visitor, and probably more that I can't think of
> right now).  This feature would be useful in these cases.  It is all about
> expressing meaning and intent in one's design and following good design
> practices.
>

Coupling it to a namespace isn't any better than coupling it to a friend.


> There is a reason that JAVA and C# have a feature like what I am
> suggesting.  It's time for the C++ language to "catch up".
>

As we like to say, until it is a proposal, it's your time to waste.
Although I plan on voting strongly against it (if I bother to be in EWG for
it, as it both isn't that important to me and I doubt you'll get it past
others in the room), good luck with it in Kona.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7bb03a9202acc10518408830
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On 1=
0 June 2015 at 18:34, Gina Stephens <span dir=3D"ltr">&lt;<a href=3D"mailto=
:zumbagina29@gmail.com" target=3D"_blank">zumbagina29@gmail.com</a>&gt;</sp=
an> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span class=
=3D""><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><div cl=
ass=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);borde=
r-left-style:solid;padding-left:1ex"><br></blockquote><div><br></div><div>P=
rotected is more restrictive.=C2=A0 Taking your example:</div><div><br></di=
v><div>class Foo { protected: void poke(); };</div><div><br></div><div>int =
main()</div><div>{</div><div>=C2=A0 =C2=A0 Foo f;</div><div>=C2=A0 =C2=A0 /=
/ write the legal code which can call f.poke() here.</div><div>}</div><div>=
=C2=A0</div></div></div></div></blockquote></span><div>GMS - Now, if I want=
 to design a class that can call poke, I need to either declare my class as=
 a friend OR subclass Foo, which both solutions creates unnecessary couplin=
g.=C2=A0 Even with the example given in which there is only 1 friend, I am =
STILL coupled to that friend.=C2=A0 The coupling is bad enough, but think a=
bout if I have an application that builds for different platforms.</div></d=
iv></blockquote><div><br></div><div>I don&#39;t see why the coupling is bad=
..=C2=A0 The friend class is part of your interface.</div><div>=C2=A0<br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div> =C2=A0My &quot;fri=
end&quot; may not even be defined for the platform for which I am building.=
=C2=A0 Then what? </div></div></blockquote><div><br></div><div>I don&#39;t =
understand.=C2=A0 That&#39;s like asking &quot;what if you don&#39;t have a=
 SetDependency call.=C2=A0 Then what?&quot;</div><div><br></div><div>Either=
 it is part of your interface and you provide it, or it isn&#39;t.</div><di=
v>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>GMS - So=
rry, but I don&#39;t agree.=C2=A0 This feature is extremely useful and is m=
ore expressive than &#39;friend&#39;.=C2=A0 As I have said before, usage of=
 friend is a band-aid for poor design choices.=C2=A0 Think about every desi=
gn pattern in which an object &#39;registers&#39; with another object (Publ=
isher-Subscriber, Dependency Injection, Visitor, and probably more that I c=
an&#39;t think of right now).=C2=A0 This feature would be useful in these c=
ases.=C2=A0 It is all about expressing meaning and intent in one&#39;s desi=
gn and following good design practices.<br></div></div></blockquote><div><b=
r></div><div>Coupling it to a namespace isn&#39;t any better than coupling =
it to a friend.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div d=
ir=3D"ltr"><div></div><div>There is a reason that JAVA and C# have a featur=
e like what I am suggesting.=C2=A0 It&#39;s time for the C++ language to &q=
uot;catch up&quot;.<br></div></div></blockquote><div><br></div><div>As we l=
ike to say, until it is a proposal, it&#39;s your time to waste.=C2=A0 Alth=
ough I plan on voting strongly against it (if I bother to be in EWG for it,=
 as it both isn&#39;t that important to me and I doubt you&#39;ll get it pa=
st others in the room), good luck with it in Kona.</div></div>-- <br><div c=
lass=3D"gmail_signature">=C2=A0Nevin &quot;:-)&quot; Liber=C2=A0 &lt;mailto=
:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_blank">nevin@evilover=
lord.com</a>&gt;=C2=A0 (847) 691-1404</div>
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7bb03a9202acc10518408830--

.


Author: Gina Stephens <zumbagina29@gmail.com>
Date: Thu, 11 Jun 2015 12:35:46 -0500
Raw View
--90e6ba6e8642f924090518416be6
Content-Type: text/plain; charset=UTF-8

*I don't see why the coupling is bad.  The friend class is part of your
interface.*

Sorry, my bad, in my example aDependency is an interface (pure abstract
class), which I didn't mention.  So, I am coupled to an interface, which is
appropriate in this case.  I could only declare my interface as a friend,
however the classes that implement the interface won't inherit the friend
relationship.  Right?  So, my concrete implementation of aDependency may or
may not be defined, depending on the platform for which I am building.
Does that clear up my statement?

*As we like to say, until it is a proposal, it's your time to waste.
Although I plan on voting strongly against it (if I bother to be in EWG for
it, as it both isn't that important to me and I doubt you'll get it past
others in the room), good luck with it in Kona*.

Honestly Nevin, I would be disappointed if you agreed with me :).  I
believe that this was a good example of the objections that I will face
from the rest of the committee, so this has been helpful.  Thank you very
much!!

Best,

Gina





On Thu, Jun 11, 2015 at 11:31 AM, Nevin Liber <nevin@eviloverlord.com>
wrote:

> On 10 June 2015 at 18:34, Gina Stephens <zumbagina29@gmail.com> wrote:
>
>>
>>>>
>>> Protected is more restrictive.  Taking your example:
>>>
>>> class Foo { protected: void poke(); };
>>>
>>> int main()
>>> {
>>>     Foo f;
>>>     // write the legal code which can call f.poke() here.
>>> }
>>>
>>>
>> GMS - Now, if I want to design a class that can call poke, I need to
>> either declare my class as a friend OR subclass Foo, which both solutions
>> creates unnecessary coupling.  Even with the example given in which there
>> is only 1 friend, I am STILL coupled to that friend.  The coupling is bad
>> enough, but think about if I have an application that builds for different
>> platforms.
>>
>
> I don't see why the coupling is bad.  The friend class is part of your
> interface.
>
>
>>  My "friend" may not even be defined for the platform for which I am
>> building.  Then what?
>>
>
> I don't understand.  That's like asking "what if you don't have a
> SetDependency call.  Then what?"
>
> Either it is part of your interface and you provide it, or it isn't.
>
>
>> GMS - Sorry, but I don't agree.  This feature is extremely useful and is
>> more expressive than 'friend'.  As I have said before, usage of friend is a
>> band-aid for poor design choices.  Think about every design pattern in
>> which an object 'registers' with another object (Publisher-Subscriber,
>> Dependency Injection, Visitor, and probably more that I can't think of
>> right now).  This feature would be useful in these cases.  It is all about
>> expressing meaning and intent in one's design and following good design
>> practices.
>>
>
> Coupling it to a namespace isn't any better than coupling it to a friend.
>
>
>> There is a reason that JAVA and C# have a feature like what I am
>> suggesting.  It's time for the C++ language to "catch up".
>>
>
> As we like to say, until it is a proposal, it's your time to waste.
> Although I plan on voting strongly against it (if I bother to be in EWG for
> it, as it both isn't that important to me and I doubt you'll get it past
> others in the room), good luck with it in Kona.
> --
>  Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>



--
Gina Stephens, MSCS

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--90e6ba6e8642f924090518416be6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"font-size:12.8000001907349px"><i>I don&#39;=
t see why the coupling is bad.=C2=A0 The friend class is part of your inter=
face.</i></span><br><div><span style=3D"font-size:12.8000001907349px"><i><b=
r></i></span></div><div><span style=3D"font-size:12.8000001907349px">Sorry,=
 my bad, in my example aDependency is an interface (pure abstract class), w=
hich I didn&#39;t mention.=C2=A0 So, I am coupled to an interface, which is=
 appropriate in this case.=C2=A0 I could only declare my interface as a fri=
end, however the classes that implement the interface won&#39;t inherit the=
 friend relationship.=C2=A0 Right?=C2=A0 So, my concrete implementation of =
aDependency may or may not be defined, depending on the platform for which =
I am building.=C2=A0 Does that clear up my statement?</span></div><div><spa=
n style=3D"font-size:12.8000001907349px"><br></span></div><div><span style=
=3D"font-size:12.8000001907349px"><i>As we like to say, until it is a propo=
sal, it&#39;s your time to waste.=C2=A0 Although I plan on voting strongly =
against it (if I bother to be in EWG for it, as it both isn&#39;t that impo=
rtant to me and I doubt you&#39;ll get it past others in the room), good lu=
ck with it in Kona</i>.</span><span style=3D"font-size:12.8000001907349px">=
<br></span></div><div><span style=3D"font-size:12.8000001907349px"><br></sp=
an></div><div><span style=3D"font-size:12.8000001907349px">Honestly Nevin, =
I would be disappointed if you agreed with me :).=C2=A0 I believe that this=
 was a good example of the objections that I will face from the rest of the=
 committee, so this has been helpful.=C2=A0 Thank you very much!!</span></d=
iv><div><span style=3D"font-size:12.8000001907349px"><br></span></div><div>=
<span style=3D"font-size:12.8000001907349px">Best,</span></div><div><span s=
tyle=3D"font-size:12.8000001907349px"><br></span></div><div><span style=3D"=
font-size:12.8000001907349px">Gina</span></div><div><span style=3D"font-siz=
e:12.8000001907349px"><br></span></div><div><br></div><div><span style=3D"f=
ont-size:12.8000001907349px"><br></span></div><div><span style=3D"font-size=
:12.8000001907349px"><br></span></div></div><div class=3D"gmail_extra"><br>=
<div class=3D"gmail_quote">On Thu, Jun 11, 2015 at 11:31 AM, Nevin Liber <s=
pan dir=3D"ltr">&lt;<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_bl=
ank">nevin@eviloverlord.com</a>&gt;</span> wrote:<br><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_qu=
ote">On 10 June 2015 at 18:34, Gina Stephens <span dir=3D"ltr">&lt;<a href=
=3D"mailto:zumbagina29@gmail.com" target=3D"_blank">zumbagina29@gmail.com</=
a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0=
 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><sp=
an><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"><div><div class=
=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-l=
eft-style:solid;padding-left:1ex"><br></blockquote><div><br></div><div>Prot=
ected is more restrictive.=C2=A0 Taking your example:</div><div><br></div><=
div>class Foo { protected: void poke(); };</div><div><br></div><div>int mai=
n()</div><div>{</div><div>=C2=A0 =C2=A0 Foo f;</div><div>=C2=A0 =C2=A0 // w=
rite the legal code which can call f.poke() here.</div><div>}</div><div>=C2=
=A0</div></div></div></div></blockquote></span><div>GMS - Now, if I want to=
 design a class that can call poke, I need to either declare my class as a =
friend OR subclass Foo, which both solutions creates unnecessary coupling.=
=C2=A0 Even with the example given in which there is only 1 friend, I am ST=
ILL coupled to that friend.=C2=A0 The coupling is bad enough, but think abo=
ut if I have an application that builds for different platforms.</div></div=
></blockquote><div><br></div><div>I don&#39;t see why the coupling is bad.=
=C2=A0 The friend class is part of your interface.</div><div>=C2=A0<br></di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div> =C2=A0My &quot;frie=
nd&quot; may not even be defined for the platform for which I am building.=
=C2=A0 Then what? </div></div></blockquote><div><br></div><div>I don&#39;t =
understand.=C2=A0 That&#39;s like asking &quot;what if you don&#39;t have a=
 SetDependency call.=C2=A0 Then what?&quot;</div><div><br></div><div>Either=
 it is part of your interface and you provide it, or it isn&#39;t.</div><di=
v>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>GMS - So=
rry, but I don&#39;t agree.=C2=A0 This feature is extremely useful and is m=
ore expressive than &#39;friend&#39;.=C2=A0 As I have said before, usage of=
 friend is a band-aid for poor design choices.=C2=A0 Think about every desi=
gn pattern in which an object &#39;registers&#39; with another object (Publ=
isher-Subscriber, Dependency Injection, Visitor, and probably more that I c=
an&#39;t think of right now).=C2=A0 This feature would be useful in these c=
ases.=C2=A0 It is all about expressing meaning and intent in one&#39;s desi=
gn and following good design practices.<br></div></div></blockquote><div><b=
r></div><div>Coupling it to a namespace isn&#39;t any better than coupling =
it to a friend.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div d=
ir=3D"ltr"><div></div><div>There is a reason that JAVA and C# have a featur=
e like what I am suggesting.=C2=A0 It&#39;s time for the C++ language to &q=
uot;catch up&quot;.<br></div></div></blockquote><div><br></div><div>As we l=
ike to say, until it is a proposal, it&#39;s your time to waste.=C2=A0 Alth=
ough I plan on voting strongly against it (if I bother to be in EWG for it,=
 as it both isn&#39;t that important to me and I doubt you&#39;ll get it pa=
st others in the room), good luck with it in Kona.</div></div><span class=
=3D"HOEnZb"><font color=3D"#888888">-- <br><div>=C2=A0Nevin &quot;:-)&quot;=
 Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D=
"_blank">nevin@eviloverlord.com</a>&gt;=C2=A0 <a href=3D"tel:%28847%29%2069=
1-1404" value=3D"+18476911404" target=3D"_blank">(847) 691-1404</a></div>
</font></span></div></div><span class=3D"HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
<br>
--- <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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r><div class=3D"gmail_signature"><div dir=3D"ltr">Gina Stephens, MSCS<br></=
div></div>
</div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--90e6ba6e8642f924090518416be6--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Thu, 11 Jun 2015 17:46:27 -0400
Raw View
--001a11c2b8e67ff33d051844ec76
Content-Type: text/plain; charset=UTF-8

java and C# have something like modules or packages, etc. C++ doesn't.
Namespaces are not the same, because it is too easy for anyone to open
them.  So restricting something to a namespace doesn't restrict any code.
The "hoop" to jump through is way to easy compared to the hoops required to
get around protected and private.  Protected and private are fences you can
jump over, if you try hard enough.  Namespace is a fence with an open gate.
(Or more like a fence that allows you to put gates wherever you want.)

If/When we get modules, then we can probably have something like java's
"package private".  (Which I personally think was a bad default in java -
the default should have been private...)

I suspect the best response you could get from the committee is "wait for
modules".  But it is probably worth discussing in that context, if it
hasn't come up already.

Tony

P.S. reflection, if/when it arrives, might also allow you to get around
protected/private, which I guess could be good for testing.



On Thu, Jun 11, 2015 at 1:35 PM, Gina Stephens <zumbagina29@gmail.com>
wrote:

> *I don't see why the coupling is bad.  The friend class is part of your
> interface.*
>
> Sorry, my bad, in my example aDependency is an interface (pure abstract
> class), which I didn't mention.  So, I am coupled to an interface, which is
> appropriate in this case.  I could only declare my interface as a friend,
> however the classes that implement the interface won't inherit the friend
> relationship.  Right?  So, my concrete implementation of aDependency may or
> may not be defined, depending on the platform for which I am building.
> Does that clear up my statement?
>
> *As we like to say, until it is a proposal, it's your time to waste.
> Although I plan on voting strongly against it (if I bother to be in EWG for
> it, as it both isn't that important to me and I doubt you'll get it past
> others in the room), good luck with it in Kona*.
>
> Honestly Nevin, I would be disappointed if you agreed with me :).  I
> believe that this was a good example of the objections that I will face
> from the rest of the committee, so this has been helpful.  Thank you very
> much!!
>
> Best,
>
> Gina
>
>
>
>
>
> On Thu, Jun 11, 2015 at 11:31 AM, Nevin Liber <nevin@eviloverlord.com>
> wrote:
>
>> On 10 June 2015 at 18:34, Gina Stephens <zumbagina29@gmail.com> wrote:
>>
>>>
>>>>>
>>>> Protected is more restrictive.  Taking your example:
>>>>
>>>> class Foo { protected: void poke(); };
>>>>
>>>> int main()
>>>> {
>>>>     Foo f;
>>>>     // write the legal code which can call f.poke() here.
>>>> }
>>>>
>>>>
>>> GMS - Now, if I want to design a class that can call poke, I need to
>>> either declare my class as a friend OR subclass Foo, which both solutions
>>> creates unnecessary coupling.  Even with the example given in which there
>>> is only 1 friend, I am STILL coupled to that friend.  The coupling is bad
>>> enough, but think about if I have an application that builds for different
>>> platforms.
>>>
>>
>> I don't see why the coupling is bad.  The friend class is part of your
>> interface.
>>
>>
>>>  My "friend" may not even be defined for the platform for which I am
>>> building.  Then what?
>>>
>>
>> I don't understand.  That's like asking "what if you don't have a
>> SetDependency call.  Then what?"
>>
>> Either it is part of your interface and you provide it, or it isn't.
>>
>>
>>> GMS - Sorry, but I don't agree.  This feature is extremely useful and is
>>> more expressive than 'friend'.  As I have said before, usage of friend is a
>>> band-aid for poor design choices.  Think about every design pattern in
>>> which an object 'registers' with another object (Publisher-Subscriber,
>>> Dependency Injection, Visitor, and probably more that I can't think of
>>> right now).  This feature would be useful in these cases.  It is all about
>>> expressing meaning and intent in one's design and following good design
>>> practices.
>>>
>>
>> Coupling it to a namespace isn't any better than coupling it to a friend.
>>
>>
>>> There is a reason that JAVA and C# have a feature like what I am
>>> suggesting.  It's time for the C++ language to "catch up".
>>>
>>
>> As we like to say, until it is a proposal, it's your time to waste.
>> Although I plan on voting strongly against it (if I bother to be in EWG for
>> it, as it both isn't that important to me and I doubt you'll get it past
>> others in the room), good luck with it in Kona.
>> --
>>  Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404
>>
>> --
>>
>> ---
>> 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.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
>
> --
> Gina Stephens, MSCS
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c2b8e67ff33d051844ec76
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>java and C# have something like modules or packa=
ges, etc. C++ doesn&#39;t.=C2=A0 Namespaces are not the same, because it is=
 too easy for anyone to open them.=C2=A0 So restricting something to a name=
space doesn&#39;t restrict any code.=C2=A0 The &quot;hoop&quot; to jump thr=
ough is way to easy compared to the hoops required to get around protected =
and private.=C2=A0 Protected and private are fences you can jump over, if y=
ou try hard enough.=C2=A0 Namespace is a fence with an open gate. (Or more =
like a fence that allows you to put gates wherever you want.)<br><br></div>=
If/When we get modules, then we can probably have something like java&#39;s=
 &quot;package private&quot;.=C2=A0 (Which I personally think was a bad def=
ault in java - the default should have been private...)<br><br>I suspect th=
e best response you could get from the committee is &quot;wait for modules&=
quot;.=C2=A0 But it is probably worth discussing in that context, if it has=
n&#39;t come up already.<br><br>Tony<br><br></div><div>P.S. reflection, if/=
when it arrives, might also allow you to get around protected/private, whic=
h I guess could be good for testing.<br><br></div><br></div><div class=3D"g=
mail_extra"><br><div class=3D"gmail_quote">On Thu, Jun 11, 2015 at 1:35 PM,=
 Gina Stephens <span dir=3D"ltr">&lt;<a href=3D"mailto:zumbagina29@gmail.co=
m" target=3D"_blank">zumbagina29@gmail.com</a>&gt;</span> wrote:<br><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr"><span class=3D""><span style=3D"fo=
nt-size:12.8000001907349px"><i>I don&#39;t see why the coupling is bad.=C2=
=A0 The friend class is part of your interface.</i></span><br><div><span st=
yle=3D"font-size:12.8000001907349px"><i><br></i></span></div></span><div><s=
pan style=3D"font-size:12.8000001907349px">Sorry, my bad, in my example aDe=
pendency is an interface (pure abstract class), which I didn&#39;t mention.=
=C2=A0 So, I am coupled to an interface, which is appropriate in this case.=
=C2=A0 I could only declare my interface as a friend, however the classes t=
hat implement the interface won&#39;t inherit the friend relationship.=C2=
=A0 Right?=C2=A0 So, my concrete implementation of aDependency may or may n=
ot be defined, depending on the platform for which I am building.=C2=A0 Doe=
s that clear up my statement?</span></div><span class=3D""><div><span style=
=3D"font-size:12.8000001907349px"><br></span></div><div><span style=3D"font=
-size:12.8000001907349px"><i>As we like to say, until it is a proposal, it&=
#39;s your time to waste.=C2=A0 Although I plan on voting strongly against =
it (if I bother to be in EWG for it, as it both isn&#39;t that important to=
 me and I doubt you&#39;ll get it past others in the room), good luck with =
it in Kona</i>.</span><span style=3D"font-size:12.8000001907349px"><br></sp=
an></div><div><span style=3D"font-size:12.8000001907349px"><br></span></div=
></span><div><span style=3D"font-size:12.8000001907349px">Honestly Nevin, I=
 would be disappointed if you agreed with me :).=C2=A0 I believe that this =
was a good example of the objections that I will face from the rest of the =
committee, so this has been helpful.=C2=A0 Thank you very much!!</span></di=
v><div><span style=3D"font-size:12.8000001907349px"><br></span></div><div><=
span style=3D"font-size:12.8000001907349px">Best,</span></div><div><span st=
yle=3D"font-size:12.8000001907349px"><br></span></div><div><span style=3D"f=
ont-size:12.8000001907349px">Gina</span></div><div><span style=3D"font-size=
:12.8000001907349px"><br></span></div><div><br></div><div><span style=3D"fo=
nt-size:12.8000001907349px"><br></span></div><div><span style=3D"font-size:=
12.8000001907349px"><br></span></div></div><div class=3D"gmail_extra"><div>=
<div class=3D"h5"><br><div class=3D"gmail_quote">On Thu, Jun 11, 2015 at 11=
:31 AM, Nevin Liber <span dir=3D"ltr">&lt;<a href=3D"mailto:nevin@eviloverl=
ord.com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;</span> wrote:<br>=
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra">=
<div class=3D"gmail_quote">On 10 June 2015 at 18:34, Gina Stephens <span di=
r=3D"ltr">&lt;<a href=3D"mailto:zumbagina29@gmail.com" target=3D"_blank">zu=
mbagina29@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr"><span><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><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(=
204,204,204);border-left-style:solid;padding-left:1ex"><br></blockquote><di=
v><br></div><div>Protected is more restrictive.=C2=A0 Taking your example:<=
/div><div><br></div><div>class Foo { protected: void poke(); };</div><div><=
br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0 Foo f;</div><d=
iv>=C2=A0 =C2=A0 // write the legal code which can call f.poke() here.</div=
><div>}</div><div>=C2=A0</div></div></div></div></blockquote></span><div>GM=
S - Now, if I want to design a class that can call poke, I need to either d=
eclare my class as a friend OR subclass Foo, which both solutions creates u=
nnecessary coupling.=C2=A0 Even with the example given in which there is on=
ly 1 friend, I am STILL coupled to that friend.=C2=A0 The coupling is bad e=
nough, but think about if I have an application that builds for different p=
latforms.</div></div></blockquote><div><br></div><div>I don&#39;t see why t=
he coupling is bad.=C2=A0 The friend class is part of your interface.</div>=
<div>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div> =
=C2=A0My &quot;friend&quot; may not even be defined for the platform for wh=
ich I am building.=C2=A0 Then what? </div></div></blockquote><div><br></div=
><div>I don&#39;t understand.=C2=A0 That&#39;s like asking &quot;what if yo=
u don&#39;t have a SetDependency call.=C2=A0 Then what?&quot;</div><div><br=
></div><div>Either it is part of your interface and you provide it, or it i=
sn&#39;t.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"=
ltr"><div>GMS - Sorry, but I don&#39;t agree.=C2=A0 This feature is extreme=
ly useful and is more expressive than &#39;friend&#39;.=C2=A0 As I have sai=
d before, usage of friend is a band-aid for poor design choices.=C2=A0 Thin=
k about every design pattern in which an object &#39;registers&#39; with an=
other object (Publisher-Subscriber, Dependency Injection, Visitor, and prob=
ably more that I can&#39;t think of right now).=C2=A0 This feature would be=
 useful in these cases.=C2=A0 It is all about expressing meaning and intent=
 in one&#39;s design and following good design practices.<br></div></div></=
blockquote><div><br></div><div>Coupling it to a namespace isn&#39;t any bet=
ter than coupling it to a friend.</div><div>=C2=A0</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><div></div><div>There is a reason that JAVA =
and C# have a feature like what I am suggesting.=C2=A0 It&#39;s time for th=
e C++ language to &quot;catch up&quot;.<br></div></div></blockquote><div><b=
r></div><div>As we like to say, until it is a proposal, it&#39;s your time =
to waste.=C2=A0 Although I plan on voting strongly against it (if I bother =
to be in EWG for it, as it both isn&#39;t that important to me and I doubt =
you&#39;ll get it past others in the room), good luck with it in Kona.</div=
></div><span><font color=3D"#888888">-- <br><div>=C2=A0Nevin &quot;:-)&quot=
; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=
=3D"_blank">nevin@eviloverlord.com</a>&gt;=C2=A0 <a href=3D"tel:%28847%29%2=
0691-1404" value=3D"+18476911404" target=3D"_blank">(847) 691-1404</a></div=
>
</font></span></div></div><span><font color=3D"#888888">

<p></p>

-- <br>
<br>
--- <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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div></div=
></div><span class=3D"HOEnZb"><font color=3D"#888888">-- <br><div><div dir=
=3D"ltr">Gina Stephens, MSCS<br></div></div>
</font></span></div><div class=3D"HOEnZb"><div class=3D"h5">

<p></p>

-- <br>
<br>
--- <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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c2b8e67ff33d051844ec76--

.


Author: Myriachan <myriachan@gmail.com>
Date: Thu, 11 Jun 2015 15:35:43 -0700 (PDT)
Raw View
------=_Part_56_1304587186.1434062144004
Content-Type: multipart/alternative;
 boundary="----=_Part_57_388799232.1434062144004"

------=_Part_57_388799232.1434062144004
Content-Type: text/plain; charset=UTF-8

On Wednesday, June 10, 2015 at 11:22:21 AM UTC-7, Nevin ":-)" Liber wrote:
>
>
> There are various ways in which I can call a private member if I really
>> want to.
>
>
> That are legal according to the C++ standard?  I know there is an
> encapsulation hole with templated member functions, but how else can you do
> it?
> --
>  Nevin ":-)" Liber  <mailto:ne...@eviloverlord.com <javascript:>>  (847)
> 691-1404
>


#include <cstdio>

class Meow
{
    struct Kitty
    {
        static void Hello()
        {
            std::printf("Cheater!\n");
        }
    };
};

template <typename = void>
using Exploit = Meow::Kitty;

int main()
{
    Exploit<>::Hello();
    return 0;
}


--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_57_388799232.1434062144004
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wednesday, June 10, 2015 at 11:22:21 AM UTC-7, Nevin ":-)" Liber 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"><div><div clas=
s=3D"gmail_quote"><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0=
 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There are various ways=
 in which I can call a private member if I really<br>
want to.</blockquote><div><br></div><div>That are legal according to the C+=
+ standard?&nbsp; I know there is an encapsulation hole with templated memb=
er functions, but how else can you do it?</div></div>-- <br><div>&nbsp;Nevi=
n ":-)" Liber&nbsp; &lt;mailto:<a href=3D"javascript:" target=3D"_blank" gd=
f-obfuscated-mailto=3D"LuppKyFPhFUJ" rel=3D"nofollow" onmousedown=3D"this.h=
ref=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';retu=
rn true;">ne...@eviloverlord.com</a><wbr>&gt;&nbsp; (847) 691-1404</div></d=
iv></div></blockquote><div><br><br><div class=3D"prettyprint" style=3D"back=
ground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-=
style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><span style=3D"color: #800;" class=
=3D"styled-by-prettify">#include</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&lt;cstdio&gt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">Meow</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 style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">Kitty</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nb=
sp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">static=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">Hello</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; std</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">pri=
ntf</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #080;" class=3D"styled-by-prettify">"Cheater!\n"</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbs=
p; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp=
; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">template</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">void</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">using</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Exploit</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Meow</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Kitty</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
<br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> main</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><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">Exploit</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;&gt;::</span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Hello</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">();</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=
=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br></sp=
an></div></code></div><br><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_57_388799232.1434062144004--
------=_Part_56_1304587186.1434062144004--

.


Author: Richard Smith <richard@metafoo.co.uk>
Date: Thu, 11 Jun 2015 15:46:44 -0700
Raw View
--001a11330cf60fcf95051845c4dd
Content-Type: text/plain; charset=UTF-8

On Thu, Jun 11, 2015 at 3:35 PM, Myriachan <myriachan@gmail.com> wrote:

> On Wednesday, June 10, 2015 at 11:22:21 AM UTC-7, Nevin ":-)" Liber wrote:
>>
>>
>> There are various ways in which I can call a private member if I really
>>> want to.
>>
>>
>> That are legal according to the C++ standard?  I know there is an
>> encapsulation hole with templated member functions, but how else can you do
>> it?
>> --
>>  Nevin ":-)" Liber  <mailto:ne...@eviloverlord.com>  (847) 691-1404
>>
>
>
> #include <cstdio>
>
> class Meow
> {
>     struct Kitty
>     {
>         static void Hello()
>         {
>             std::printf("Cheater!\n");
>         }
>     };
> };
>
> template <typename = void>
> using Exploit = Meow::Kitty;
>
> int main()
> {
>     Exploit<>::Hello();
>     return 0;
> }
>

That's a popular bug (present in Clang and GCC, but not EDG or MSVC), not a
hole in the access rules.

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11330cf60fcf95051845c4dd
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
hu, Jun 11, 2015 at 3:35 PM, Myriachan <span dir=3D"ltr">&lt;<a href=3D"mai=
lto:myriachan@gmail.com" target=3D"_blank">myriachan@gmail.com</a>&gt;</spa=
n> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><span class=3D"">On Wednesday, =
June 10, 2015 at 11:22:21 AM UTC-7, Nevin &quot;:-)&quot; Liber wrote:</spa=
n><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><span class=
=3D""><div class=3D"gmail_quote"><br><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There a=
re various ways in which I can call a private member if I really<br>
want to.</blockquote><div><br></div><div>That are legal according to the C+=
+ standard?=C2=A0 I know there is an encapsulation hole with templated memb=
er functions, but how else can you do it?</div></div>-- <br></span><div>=C2=
=A0Nevin &quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a rel=3D"nofollow">ne...@e=
viloverlord.com</a>&gt;=C2=A0 <a href=3D"tel:%28847%29%20691-1404" value=3D=
"+18476911404" target=3D"_blank">(847) 691-1404</a></div></div></div></bloc=
kquote><div><br><br><div style=3D"background-color:rgb(250,250,250);border-=
color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-=
word"><code><div><span style=3D"color:#800">#include</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#080">&lt;cstdio&gt;</span><span st=
yle=3D"color:#000"><br><br></span><span style=3D"color:#008">class</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#606">Meow</span><spa=
n style=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span =
style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">st=
ruct</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Ki=
tty</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 </span><span style=3D"color:#008">static</span><span style=3D"color=
:#000"> </span><span style=3D"color:#008">void</span><span style=3D"color:#=
000"> </span><span style=3D"color:#606">Hello</span><span style=3D"color:#6=
60">()</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </s=
pan><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660"=
>::</span><span style=3D"color:#000">printf</span><span style=3D"color:#660=
">(</span><span style=3D"color:#080">&quot;Cheater!\n&quot;</span><span sty=
le=3D"color:#660">);</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">};</span><span sty=
le=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span styl=
e=3D"color:#000"><br><br></span><span style=3D"color:#008">template</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span><sp=
an style=3D"color:#008">typename</span><span style=3D"color:#000"> </span><=
span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">void</span><span style=3D"color:#660">&gt;</span><sp=
an style=3D"color:#000"><br></span><span style=3D"color:#008">using</span><=
span style=3D"color:#000"> </span><span style=3D"color:#606">Exploit</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#606">Meow</span><span=
 style=3D"color:#660">::</span><span style=3D"color:#606">Kitty</span><span=
 style=3D"color:#660">;</span><span style=3D"color:#000"><br><br></span><sp=
an style=3D"color:#008">int</span><span style=3D"color:#000"> main</span><s=
pan style=3D"color:#660">()</span><span style=3D"color:#000"><br></span><sp=
an style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#606">Exploit</span><span style=3D"color:#6=
60">&lt;&gt;::</span><span style=3D"color:#606">Hello</span><span style=3D"=
color:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><=
span style=3D"color:#008">return</span><span style=3D"color:#000"> </span><=
span style=3D"color:#066">0</span><span style=3D"color:#660">;</span><span =
style=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"> <br></span></div></code></div></div></blockquote></div>=
<br></div><div class=3D"gmail_extra">That&#39;s a popular bug (present in C=
lang and GCC, but not EDG or MSVC), not a hole in the access rules.</div></=
div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11330cf60fcf95051845c4dd--

.


Author: inkwizytoryankes@gmail.com
Date: Fri, 12 Jun 2015 10:27:08 -0700 (PDT)
Raw View
------=_Part_1055_1990733117.1434130028499
Content-Type: multipart/alternative;
 boundary="----=_Part_1056_456277159.1434130028499"

------=_Part_1056_456277159.1434130028499
Content-Type: text/plain; charset=UTF-8



On Thursday, June 11, 2015 at 12:04:49 AM UTC+2, Nevin ":-)" Liber wrote:
>
> On 10 June 2015 at 16:48, Matthew Woehlke <mw_t...@users.sourceforge.net
> <javascript:>> wrote:
>
>>  [sinp]
>
>
>> I've prevented you accessing it without consciously circumventing an
>> access protection. That's... about equally secure as protected.
>>
>
> Protected is more restrictive.  Taking your example:
>
> class Foo { protected: void poke(); };
>
> int main()
> {
>     Foo f;
>     // write the legal code which can call f.poke() here.
> }
>

class Foo { protected: void poke(); };

int main()
{
    Foo f;
    struct Hack : Foo
    {
      Hack(Foo& f)
      {
        auto x = &Hack::poke;
        (f.*x)();
      }
    } h(f); //call poke
}
At least gcc 4.9.2 accepts it.



--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1056_456277159.1434130028499
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<br><br>On Thursday, June 11, 2015 at 12:04:49 AM UTC+2, Nevin ":-)" Liber =
wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><d=
iv class=3D"gmail_quote">On 10 June 2015 at 16:48, Matthew Woehlke <span di=
r=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mail=
to=3D"sjcIA4c7sY8J" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript=
:';return true;" onclick=3D"this.href=3D'javascript:';return true;">mw_t...=
@users.sourceforge.<wbr>net</a>&gt;</span> wrote:<br><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-=
left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">&nbsp=
;[sinp]</blockquote></div></div></div></blockquote><blockquote class=3D"gma=
il_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid=
;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-=
width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;paddin=
g-left:1ex">
<br>
I've prevented you accessing it without consciously circumventing an<br>
access protection. That's... about equally secure as protected.<br></blockq=
uote><div><br></div><div>Protected is more restrictive.&nbsp; Taking your e=
xample:</div><div><br></div><div>class Foo { protected: void poke(); };</di=
v><div><br></div><div>int main()</div><div>{</div><div>&nbsp; &nbsp; Foo f;=
</div><div>&nbsp; &nbsp; // write the legal code which can call f.poke() he=
re.</div><div>}</div></div></div></div></blockquote><div><br><div class=3D"=
prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break=
-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">Foo</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>protected</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: #008;" class=3D"styled-by-prettify">void</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> poke</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"col=
or: #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"><br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> main</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>&nbsp; =
&nbsp; </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Foo=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span><code class=3D"p=
rettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">&nbsp=
; &nbsp; </span><span style=3D"color: #606;" class=3D"styled-by-prettify"><=
/span></code><span style=3D"color: #008;" class=3D"styled-by-prettify">stru=
ct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #606;" class=3D"styled-by-prettify">Hack</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: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify">Foo</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>&nbsp; &nbsp; &nbsp; </span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Hack</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">(</span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Foo</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> f</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &=
nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> x </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Hack</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">poke</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">f</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">.*</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">x</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">)();</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>&nbsp; &nbsp; &nbsp; </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> h</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">f<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> //call poke<br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div=
></code></div>At least gcc 4.9.2 accepts it.<br><br>&nbsp;</div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1056_456277159.1434130028499--
------=_Part_1055_1990733117.1434130028499--

.


Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Mon, 15 Jun 2015 09:24:25 +0100
Raw View
--089e0158b6c0828e5b05188a2fe7
Content-Type: text/plain; charset=UTF-8

That is legal,

   In the expression: `&Hack::poke` the access specifier is checked and
succeeds, but the expression yields a `void (Foo::*)()`, which in my
opinion is wrong.

   I believe should be `void (Hack::*)()` (see
http://open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3772.pdf), if the
suggested change was accepted (it was marked as duplicate, but the original
DR has not seen much activity.

   But the point is not whether you  can, but whether the language/compiler
are there to help or police you. There are ways, again through
pointers-to-members of accessing even private members. The fact is that you
can, but adding a new access specifier won't close those holes or, in my
opinion, provide many advantages over what we already have.

    David

On Fri, Jun 12, 2015 at 6:27 PM, <inkwizytoryankes@gmail.com> wrote:

>
>
> On Thursday, June 11, 2015 at 12:04:49 AM UTC+2, Nevin ":-)" Liber wrote:
>>
>> On 10 June 2015 at 16:48, Matthew Woehlke <mw_t...@users.sourceforge.net>
>> wrote:
>>
>>>  [sinp]
>>
>>
>>> I've prevented you accessing it without consciously circumventing an
>>> access protection. That's... about equally secure as protected.
>>>
>>
>> Protected is more restrictive.  Taking your example:
>>
>> class Foo { protected: void poke(); };
>>
>> int main()
>> {
>>     Foo f;
>>     // write the legal code which can call f.poke() here.
>> }
>>
>
> class Foo { protected: void poke(); };
>
> int main()
> {
>     Foo f;
>     struct Hack : Foo
>     {
>       Hack(Foo& f)
>       {
>         auto x = &Hack::poke;
>         (f.*x)();
>       }
>     } h(f); //call poke
> }
> At least gcc 4.9.2 accepts it.
>
>
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--089e0158b6c0828e5b05188a2fe7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">That is legal,=C2=A0<div><br></div><div>=C2=A0 =C2=A0In th=
e expression: `&amp;Hack::poke` the access specifier is checked and succeed=
s, but the expression yields a `void (Foo::*)()`, which in my opinion is wr=
ong. <br><br>=C2=A0 =C2=A0I believe should be `void (Hack::*)()` (see=C2=A0=
<a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3772.pdf">h=
ttp://open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3772.pdf</a>), if the s=
uggested change was accepted (it was marked as duplicate, but the original =
DR has not seen much activity.<br><br>=C2=A0 =C2=A0But the point is not whe=
ther you =C2=A0can, but whether the language/compiler are there to help or =
police you. There are ways, again through pointers-to-members of accessing =
even private members. The fact is that you can, but adding a new access spe=
cifier won&#39;t close those holes or, in my opinion, provide many advantag=
es over what we already have.<br><br>=C2=A0 =C2=A0 David</div></div><div cl=
ass=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, Jun 12, 2015 at =
6:27 PM,  <span dir=3D"ltr">&lt;<a href=3D"mailto:inkwizytoryankes@gmail.co=
m" target=3D"_blank">inkwizytoryankes@gmail.com</a>&gt;</span> wrote:<br><b=
lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =
#ccc solid;padding-left:1ex"><br><br>On Thursday, June 11, 2015 at 12:04:49=
 AM UTC+2, Nevin &quot;:-)&quot; Liber wrote:<blockquote class=3D"gmail_quo=
te" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-=
left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote">On 10 June 2015 =
at 16:48, Matthew Woehlke <span dir=3D"ltr">&lt;<a rel=3D"nofollow">mw_t...=
@users.sourceforge.net</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-=
color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">=C2=A0[sin=
p]</blockquote></div></div></div></blockquote><span class=3D""><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><div class=3D"gmail_quote=
"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde=
r-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid=
;padding-left:1ex">
<br>
I&#39;ve prevented you accessing it without consciously circumventing an<br=
>
access protection. That&#39;s... about equally secure as protected.<br></bl=
ockquote><div><br></div><div>Protected is more restrictive.=C2=A0 Taking yo=
ur example:</div><div><br></div><div>class Foo { protected: void poke(); };=
</div><div><br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0 Fo=
o f;</div><div>=C2=A0 =C2=A0 // write the legal code which can call f.poke(=
) here.</div><div>}</div></div></div></div></blockquote></span><div><br><di=
v style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);=
border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span =
class=3D""><span style=3D"color:#008">class</span><span style=3D"color:#000=
"> </span><span style=3D"color:#606">Foo</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">protected</span><span style=3D"color:#660">:</=
span><span style=3D"color:#000"> </span><span style=3D"color:#008">void</sp=
an><span style=3D"color:#000"> poke</span><span style=3D"color:#660">();</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">};</span>=
<span style=3D"color:#000"><br><br></span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#000"> main</span><span style=3D"color:#660">()</s=
pan><span style=3D"color:#000"><br></span><span style=3D"color:#660">{</spa=
n><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:=
#606">Foo</span><span style=3D"color:#000"> f</span><span style=3D"color:#6=
60">;</span><span style=3D"color:#000"><br></span></span><code><span style=
=3D"color:#000">=C2=A0 =C2=A0 </span><span style=3D"color:#606"></span></co=
de><span style=3D"color:#008">struct</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#606">Hack</span><span style=3D"color:#000"> </span=
><span style=3D"color:#660">:</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#606">Foo</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#606">Hack</span><span s=
tyle=3D"color:#660">(</span><span style=3D"color:#606">Foo</span><span styl=
e=3D"color:#660">&amp;</span><span style=3D"color:#000"> f</span><span styl=
e=3D"color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">auto</span>=
<span style=3D"color:#000"> x </span><span style=3D"color:#660">=3D</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;</span><s=
pan style=3D"color:#606">Hack</span><span style=3D"color:#660">::</span><sp=
an style=3D"color:#000">poke</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D=
"color:#660">(</span><span style=3D"color:#000">f</span><span style=3D"colo=
r:#660">.*</span><span style=3D"color:#000">x</span><span style=3D"color:#6=
60">)();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 </span><=
span style=3D"color:#660">}</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#000"> h=
</span><span style=3D"color:#660">(</span><span style=3D"color:#000">f</spa=
n><span style=3D"color:#660">);</span><span style=3D"color:#000"> //call po=
ke<br></span><span style=3D"color:#660">}</span></div></code></div>At least=
 gcc 4.9.2 accepts it.<br><br>=C2=A0</div><div class=3D"HOEnZb"><div class=
=3D"h5">

<p></p>

-- <br>
<br>
--- <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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e0158b6c0828e5b05188a2fe7--

.