220 5962 <1f562671-aa29-418d-b89f-d81092cb2be9@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nick <nicolas.jinchereau@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Properties Syntax
Date: Wed, 28 Aug 2013 17:18:11 -0700 (PDT)
Lines: 263
Approved: news@gmane.org
Message-ID: <1f562671-aa29-418d-b89f-d81092cb2be9@isocpp.org>
References: <e18c3ee9-66f7-48e0-bd8b-04051c952de0@isocpp.org>
 <5e23a0e9-2bd9-4f62-aa83-47bea8144eae@isocpp.org>
 <521DAAF4.3050100@beamways.com>
 <CAFk2RUaqD5GJXhf54=T_ioc_JxLfRbPjaiV1QPVOKgV2gFk4MA@mail.gmail.com>
 <521DE3EC.4040404@beamways.com>
 <b9a92bd1-4034-4b9d-8753-a98bbfe9034a@isocpp.org>
 <CAFk2RUaixkwnekjpkG4ZnwSs3uGNbTMXZf3+Vm5MBTD-bcNqUg@mail.gmail.com>
 <521E8AB0.6070906@numericable.fr>
 <fb8c78d9-1aeb-4097-93de-3833eb243fb1@isocpp.org>
 <CAOU91OMmaeSfANPvmJh0xnR_FGDSn9vxQWsz=8PwY4JkRMXQaw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_870_21621027.1377735491507"
X-Trace: ger.gmane.org 1377735491 19697 80.91.229.3 (29 Aug 2013 00:18:11 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 29 Aug 2013 00:18:11 +0000 (UTC)
Cc: Ville Voutilainen <ville.voutilainen@gmail.com>
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC42HSUOVYGBBRFG7KIAKGQE5Z556TA@isocpp.org Thu Aug 29 02:18:14 2013
Return-path: <std-proposals+bncBC42HSUOVYGBBRFG7KIAKGQE5Z556TA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gh0-f199.google.com ([209.85.160.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC42HSUOVYGBBRFG7KIAKGQE5Z556TA@isocpp.org>)
	id 1VEpwD-0003sS-JL
	for gclcip-std-proposals@m.gmane.org; Thu, 29 Aug 2013 02:18:13 +0200
Original-Received: by mail-gh0-f199.google.com with SMTP id g14sf7210487ghb.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 28 Aug 2013 17:18:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=d63Z9Qs6g/8arPrhMo8KtfLRwmJn5magp5ptH8vbprU=;
        b=ChLCiLNx7Q1M65IIaX7XPvRlSfvOB5Uj7ZgjSFsGQolimbByVkM9y879keSb0Y1AIZ
         A9O6AWJ7SmIM0EiEB9wu0yc+iDeaJrPZy2aw5uXCfLdZFzJW+AgGJyCq0WY1MyHq1hl2
         GF4RyChhcAnxTTTlBRrk+ck6b0dtL3RGd4OHjWI8MKZEp/zvWzj7A5dfLK6kikSnVxzV
         JbnVr5Zrc3Sg0htQb/AgRIb7GqmTcF0sOQ9KKMAN+oATOZ3ZxjCjfdNATcNWHrb3Zl0g
         A38fT7su+IToOSthp47wu7NqXobVWBdacyi5bFioCGf/ZoEY/nZG4JgE1JqhXIt8Wy2T
         TjPg==
X-Received: by 10.236.63.165 with SMTP id a25mr151139yhd.43.1377735492693;
        Wed, 28 Aug 2013 17:18:12 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.94.71 with SMTP id da7ls577669qeb.49.gmail; Wed, 28 Aug
 2013 17:18:12 -0700 (PDT)
X-Received: by 10.49.128.129 with SMTP id no1mr16404qeb.23.1377735492258;
        Wed, 28 Aug 2013 17:18:12 -0700 (PDT)
In-Reply-To: <CAOU91OMmaeSfANPvmJh0xnR_FGDSn9vxQWsz=8PwY4JkRMXQaw@mail.gmail.com>
X-Original-Sender: nicolas.jinchereau@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:5962
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5962>

------=_Part_870_21621027.1377735491507
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Wednesday, 28 August 2013 20:06:34 UTC-4, Klaim - Jo=EBl Lamotte wrote:

>
> On Thu, Aug 29, 2013 at 1:49 AM, Nick <nicolas.j...@gmail.com<javascript:=
>
> > wrote:
>
>> could you clarify what you mean by non-auto property?
>>
>
> I believe Loic means that if I have a initial version of some code that=
=20
> look like this:
>
> struct K
> {
>     int count;
> };
>
> int f( K& k )
> {
>    return k.count; =20
> }
>
> Then (years) later I upgrade it with some checks using some property=20
> syntax, but want to keep the retrocompatibility:
>
> class K // another retrocompatible change
> {
> public:
>    =20
>     property int count { //* */ }
>
> }
>
> Assuming the property works like a public variable, then this is useful.
>
> However, if I started my code like this, as a lot of code does:
>
> struct K
> {
>     int count();
> };
>
> int f( K& k )
> {
>    return k.count(); =20
> }
>
> Then there is no benefit in upgrading to properties, because it will not=
=20
> be retro-compatible.
>
> I don't have an opinion on this point. However it might point that a=20
> property feature without
> a way to implicitely use member functions like if they were properties (a=
s=20
> some suggested) would not use useful for code
> that is already written.
>
> It feels a bit like allowing k.count() to be written count(k) : it might=
=20
> help generalization, but only with new code.
>
>
> Joel Lamotte
>
>

If I understand correctly,

while std::vector is currently implemented like this:

vector<T> {
    size_t size() const { return _last - _first; }
};

and the size can be taken like this:

vector<int> myVec;
size_t sz =3D myVec.size();

then you are saying that the implementation of vector should be able to be=
=20
upgraded to:

vector<T> {
    auto_property size_t size() const { return _last - _first; }
};

and still allow for both usages?

vector<int> myVec;
size_t sz1 =3D myVec.size();
size_t sz2 =3D myVec.size;

If this is correct, then I agree completely, and I think that this is=20
feasible using the function based property syntax that I initially proposed=
..
=20

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_870_21621027.1377735491507
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"font-size: 13px;">On Wednesday, 28 August 2=
013 20:06:34 UTC-4, Klaim - Jo=EBl Lamotte  wrote:</span><br><div><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br><div class=3D=
"gmail_quote">On Thu, Aug 29, 2013 at 1:49 AM, Nick <span dir=3D"ltr">&lt;<=
a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"bfOXUe0d9=
-sJ">nicolas.j...@gmail.com</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;p=
adding-left:1ex"><div dir=3D"ltr">could you clarify what you mean by non-au=
to property?<div>
</div></div></blockquote></div><br>I believe Loic means that if I have a in=
itial version of some code that look like this:<br><br>struct K<br>{</div><=
div>&nbsp; &nbsp; int count;</div><div>};</div>
<div><br></div><div>int f( K&amp; k )</div><div>{</div><div>&nbsp; &nbsp;re=
turn k.count; &nbsp;</div><div>}<br><br>Then (years) later I upgrade it wit=
h some checks using some property syntax, but want to keep the retrocompati=
bility:<br>
<br>class K // another retrocompatible change<br>{</div><div>public:</div><=
div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; property int count { //* */=
 }</div><div><br>
</div><div>}</div><div><br></div><div>Assuming the property works like a pu=
blic variable, then this is useful.<br><br></div><div>However, if I started=
 my code like this, as a lot of code does:<br>
<br><div>struct K<br>{</div><div>&nbsp; &nbsp; int count();</div><div>};</d=
iv><div><br></div><div>int f( K&amp; k )</div><div>
{</div><div>&nbsp; &nbsp;return k.count(); &nbsp;</div><div>}<br><br>Then t=
here is no benefit in upgrading to properties, because it will not be retro=
-compatible.<br><br>I don't have an opinion on this point. However it might=
 point that a property feature without<br>
a way to implicitely use member functions like if they were properties (as =
some suggested) would not use useful for code<br>that is already written.<b=
r><br>It feels a bit like allowing k.count() to be written count(k) : it mi=
ght help generalization, but only with new code.<br>
<br><br>Joel Lamotte<br><br></div></div></div></blockquote><div><br></div><=
div><br></div>If I understand correctly,<div><br></div><div>while std::vect=
or is currently implemented like this:</div><div><br></div><div class=3D"pr=
ettyprint" style=3D"border: 1px solid rgb(187, 187, 187); background-color:=
 rgb(250, 250, 250); word-wrap: break-word;"><code class=3D"prettyprint"><d=
iv class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by=
-prettify">vector</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; size_t size</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">return</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> _last </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">-</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
_first</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">};</span></div></code></div><div><br>=
</div><div>and the size can be taken like this:</div><div><br></div><div cl=
ass=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); backgrou=
nd-color: rgb(250, 250, 250); word-wrap: break-word;"><code class=3D"pretty=
print"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"=
styled-by-prettify">vector</span><span style=3D"color: #080;" class=3D"styl=
ed-by-prettify">&lt;int&gt;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> myVec</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>size_t sz </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> myVec</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">size</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">();</span></div></=
code></div><div><br></div><div>then you are saying that the implementation =
of vector should be able to be upgraded to:</div><div><br></div><div><div c=
lass=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); backgro=
und-color: rgb(250, 250, 250); word-wrap: break-word;"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D=
"styled-by-prettify">vector</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; auto=
_property size_t size</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">const<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> _last </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> _first</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span></d=
iv></code></div><span class=3D"styled-by-prettify" style=3D"font-family: mo=
nospace; background-color: rgb(250, 250, 250); color: rgb(102, 102, 0);"><b=
r></span>and still allow for both usages?</div><div><br></div><div><div cla=
ss=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); backgroun=
d-color: rgb(250, 250, 250); word-wrap: break-word;"><code class=3D"prettyp=
rint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">vector</span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&lt;int&gt;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> myVec</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>size_t sz1 </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> myVec</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">size</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>size_t sz2 </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> myVec</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">size</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span></div></code></div><span class=3D"styl=
ed-by-prettify" style=3D"font-family: monospace; background-color: rgb(250,=
 250, 250); color: rgb(102, 102, 0);"><br></span></div><div><span style=3D"=
font-size: 13px;">If this is correct, then I agree completely,&nbsp;</span>=
<font style=3D"font-size: 13px;">and I think that this is&nbsp;</font><span=
 style=3D"font-size: 13px;">feasible</span><font style=3D"font-size: 13px;"=
>&nbsp;using the function based property syntax that I&nbsp;initially&nbsp;=
proposed.</font></div><div>&nbsp;</div></div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_870_21621027.1377735491507--

.
