220 19951 <1115b787-4cfd-4052-9f49-ece9c4bdf2ec@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: NDos Dannyu <ndospark320@naver.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Address of a reference: determining the value
 category of what it refers?
Date: Fri, 21 Aug 2015 17:52:59 -0700 (PDT)
Lines: 191
Approved: news@gmane.org
Message-ID: <1115b787-4cfd-4052-9f49-ece9c4bdf2ec@isocpp.org>
References: <76fe342f-3342-4355-af20-1c41b21e54aa@isocpp.org>
 <CANh8DEk8mVDWksjmej6BbHw3GH0Rhqfp0XpQq2RORtj6fcDHXw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_324_626021455.1440204779259"
X-Trace: ger.gmane.org 1440204784 18427 80.91.229.3 (22 Aug 2015 00:53:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 22 Aug 2015 00:53:04 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCX7FRO67EHRB3EP36XAKGQEPC33B2Q@isocpp.org Sat Aug 22 02:53:03 2015
Return-path: <std-proposals+bncBCX7FRO67EHRB3EP36XAKGQEPC33B2Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f197.google.com ([209.85.192.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCX7FRO67EHRB3EP36XAKGQEPC33B2Q@isocpp.org>)
	id 1ZSx3O-0003sS-Tl
	for gclcip-std-proposals@m.gmane.org; Sat, 22 Aug 2015 02:53:03 +0200
Original-Received: by pdph1 with SMTP id h1sf155684034pdp.0
        for <gclcip-std-proposals@m.gmane.org>; Fri, 21 Aug 2015 17:53:01 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=T5RGi+mqaHrmcm2gGxSyrNe9BKtgMWv4Hj6UG7vku4o=;
        b=iJhTRd2gNh46jU66DXgZr3+NVXiskF0kLv52wDLJ8AdBq7TdjtZ1K+11sjtGtDRXe4
         eisPVEGLwsWfoC9lBOqvAR51x2rf/kQOR6OnNLmAbTZlOEXAgEcKZJYAvds5AWO479ZY
         HacvfwG0AssQORBWNH0g2DlDjZxae/oQOEOzmiy0FQGv4854C32YeVaBKwuME+holXsE
         Cnpf/lqlHbYPMXTgAYgGFJjv3WaLgZcwTkNNhM9FJu8PT1RNxudepe0szFKFeSgZTn/O
         2niyM7SlelqoQM+59Xcu3s+Mp6k1bG1iyDSRbWVbxRTfjvEhhWSd8yStV/m7gn/Jfu+e
         +maw==
X-Gm-Message-State: ALoCoQn3O3fmu2jcsTQzWWd8WzllaabgV0Ak+8fQsep02YM3ETxR2ryvy2yCoZ5R+E63PxuAQEW1
X-Received: by 10.66.119.201 with SMTP id kw9mr9146982pab.4.1440204781757;
        Fri, 21 Aug 2015 17:53:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.16.163 with SMTP id 35ls937680ioq.71.gmail; Fri, 21 Aug
 2015 17:53:00 -0700 (PDT)
X-Received: by 10.50.28.19 with SMTP id x19mr115327igg.16.1440204780812;
        Fri, 21 Aug 2015 17:53:00 -0700 (PDT)
In-Reply-To: <CANh8DEk8mVDWksjmej6BbHw3GH0Rhqfp0XpQq2RORtj6fcDHXw@mail.gmail.com>
X-Original-Sender: ndospark320@naver.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19951
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19951>

------=_Part_324_626021455.1440204779259
Content-Type: multipart/alternative; 
	boundary="----=_Part_325_475612207.1440204779259"

------=_Part_325_475612207.1440204779259
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



2015=EB=85=84 8=EC=9B=94 22=EC=9D=BC =ED=86=A0=EC=9A=94=EC=9D=BC =EC=98=A4=
=EC=A0=84 8=EC=8B=9C 49=EB=B6=84 45=EC=B4=88 UTC+9, Matt Calabrese =EB=8B=
=98=EC=9D=98 =EB=A7=90:

> Taking the address of an object in C++ doesn't yield a null pointer, and=
=20
> users should be able to dereference the address of an object to retrieve=
=20
> the original value.=20
>
A reference ISN'T an object; it is, literally, a reference to an object.
But *const int &rcr(0)* doesn't refer to an object. It refers to zero,=20
which isn't an object. Zero doesn't have an address, so rcr should also not=
=20
have an address.

> This also wouldn't really be implementable anyway

I thought the compiler would know what a reference is and what the=20
reference refers to. Isn't it implementable built-in then...?

>  since soon as you introduce a level of indirection by passing the object=
=20
> by reference to a function, you'd no longer know that it referred to a=20
> literal

I don't get it. For example:
    *int &foor(int &r) {*
*        return r;*
*    }*
*    const int &foocr(const int &rc) {*
*        return cr;*
*    }*
    *int &&foorr(int &&rr) {*
*        return rr;*
*    }*
*    int main() {*
*        int i(0);*
*        foor(i); // OK*
*        // foor(0); // error: r can't be initialized with 0*
*        foocr(i); // OK*
*        foocr(0); // OK*
*        // foorr(i); // error: rr can't be initialized with i*
*        foorr(0); // OK*
*    }*
A function every argument is initialized when it is called; the function=20
well-knows what its arguments exactly are. No problem.

My original intentions were:

I have a value class indicating a finite discrete random variable.
But I had a problem. For example, assume that I have a variable named X.
But how can P(X<X=C2=B2) interpreted? X is still X, even it is squared, isn=
't it?
Things will get much more complicated if I have multiple variables, X, Y=20
and Z,
and I have to do like P(X<X=C2=B2=3DY>|Z|) or something.=20
So I decided to make a bind of variables.
It would be a tree structure, consisting of other binds or variables.
If it consists of references of variables, it will know what variables are=
=20
same(or dependant) and what variables are different(or indepentant).
But how can I deal with rvalues? For examples, 1 can be seen as a variable=
=20
which is always 1.
But it has no name. It is just 1. It is always indepentant from=20
other variables.
So I made it to consist of const lvalue references,=20
which can initialized with lvalue or rvalue.
But how can I determine it refers to lvalue or rvalue?? I couldn't find any=
=20
solution from the standard library.=20

=20
=20
=20
=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_325_475612207.1440204779259
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>2015=EB=85=84 8=EC=9B=94 22=EC=9D=BC =ED=86=A0=EC=
=9A=94=EC=9D=BC =EC=98=A4=EC=A0=84 8=EC=8B=9C 49=EB=B6=84 45=EC=B4=88 UTC+9=
, Matt Calabrese =EB=8B=98=EC=9D=98 =EB=A7=90:<br><blockquote class=3D"gmai=
l_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left=
-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: soli=
d;"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div>Taking the addres=
s of an object in C++ doesn&#39;t yield a null pointer, and users should be=
 able to dereference the address of an object to retrieve the original valu=
e. </div></div></div></div></blockquote><div>A reference ISN&#39;T an objec=
t; it is, literally, a reference to an object.</div><div>But <strong>const =
int &amp;rcr(0)</strong> doesn&#39;t refer to an object. It refers to zero,=
 which isn&#39;t an object. Zero doesn&#39;t have an address, so rcr should=
 also not have an address.</div><blockquote class=3D"gmail_quote" style=3D"=
margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 2=
04, 204); border-left-width: 1px; border-left-style: solid;">This also woul=
dn&#39;t really be implementable anyway</blockquote><div>I thought the comp=
iler would know what=C2=A0a=C2=A0reference is and what the reference refers=
 to. Isn&#39;t=C2=A0it implementable built-in then...?</div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; b=
order-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-s=
tyle: solid;">=C2=A0since soon as you introduce a level of indirection by p=
assing the object by reference to a function, you&#39;d no longer know that=
 it referred to a literal</blockquote><div>I don&#39;t get it.=C2=A0For exa=
mple:</div><div>=C2=A0=C2=A0=C2=A0=C2=A0<strong>int=C2=A0&amp;foor(int &amp=
;r) {</strong></div><div><strong>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 return r;</strong></div><div><strong>=C2=A0=C2=A0=C2=A0 }</strong></div><d=
iv><strong>=C2=A0=C2=A0=C2=A0 const int &amp;foocr(const int &amp;rc) {</st=
rong></div><div><strong>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return c=
r;</strong></div><div><strong>=C2=A0=C2=A0=C2=A0 }</strong></div><div>=C2=
=A0=C2=A0=C2=A0 <strong>int &amp;&amp;foorr(int &amp;&amp;rr) {</strong></d=
iv><div><strong>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return rr;</stro=
ng></div><div><strong>=C2=A0=C2=A0=C2=A0 }</strong></div><div><strong>=C2=
=A0=C2=A0=C2=A0 int main() {</strong></div><div><strong>=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 int i(0);</strong></div><div><strong>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 foor(i); // OK</strong></div><div><strong>=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // foor(0); // error: r can&#39;=
t be initialized with 0</strong></div><div><strong>=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 foocr(i); // OK</strong></div><div><strong>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 foocr(0); // OK</strong></div><div><strong>=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // foorr(i); // error: rr can&#3=
9;t be initialized with i</strong></div><div><strong>=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 foorr(0); // OK</strong></div><div><strong>=C2=A0=C2=
=A0=C2=A0 }</strong></div><div>A function every argument is initialized whe=
n it is called; the function well-knows what its arguments exactly are. No =
problem.</div><div><br></div><div>My original intentions were:</div><blockq=
uote style=3D"margin-right: 0px;" dir=3D"ltr"><div><font color=3D"#000000">=
I have a value class indicating a finite discrete random variable.</font></=
div><div>But I had a problem. For example, assume that=C2=A0I have a variab=
le named X.</div><div>But=C2=A0how=C2=A0can=C2=A0P(X&lt;X=C2=B2) interprete=
d? X is still X, even it is squared, isn&#39;t it?</div><div>Things will ge=
t much more complicated if=C2=A0I have multiple variables, X, Y and Z,</div=
><div>and I have to do like P(X&lt;X=C2=B2=3DY&gt;|Z|) or something.=C2=A0<=
/div><div>So I decided to=C2=A0make a bind of variables.</div><div>It would=
 be a tree structure, consisting of=C2=A0other=C2=A0binds=C2=A0or variables=
..</div><div>If=C2=A0it=C2=A0consists=C2=A0of references of variables, it wi=
ll know what variables are same(or dependant) and=C2=A0what variables are d=
ifferent(or indepentant).</div><div>But=C2=A0how can I deal with rvalues?=
=C2=A0For examples, 1 can be seen as a variable which is always 1.</div><di=
v>But it has=C2=A0no name. It is just 1. It=C2=A0is always indepentant from=
 other=C2=A0variables.</div><div>So I=C2=A0made it=C2=A0to consist of const=
 lvalue references, which=C2=A0can=C2=A0initialized=C2=A0with lvalue or rva=
lue.</div><div>But=C2=A0how can I determine it=C2=A0refers to lvalue or rva=
lue?? I couldn&#39;t find any solution from the standard library.=C2=A0</di=
v></blockquote><blockquote style=3D"margin-right: 0px;" dir=3D"ltr"><div>=
=C2=A0</div><div>=C2=A0</div><div>=C2=A0</div><div>=C2=A0</div></blockquote=
><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padd=
ing-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1p=
x; border-left-style: solid;"></blockquote></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_325_475612207.1440204779259--
------=_Part_324_626021455.1440204779259--

.
