220 2228 <ef15483d-5665-4da3-9b79-aefd3c725e1b@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: optional<T>, one more value or two states
Date: Thu, 24 Jan 2013 22:55:08 -0800 (PST)
Lines: 104
Approved: news@gmane.org
Message-ID: <ef15483d-5665-4da3-9b79-aefd3c725e1b@isocpp.org>
References: <CAGsORuC1ADLXgS9AZZiTo=knmhT-+9Yj+82v+b8Nq_WJpb1fOg@mail.gmail.com>
 <CAFk2RUZyZA0LLUNuVNcnibv+qBF69jMytWQL3tkp-Kp21oEU+A@mail.gmail.com>
 <CAGsORuB-Qkx-LaXj2jO4yLrwN524kiJONSg7oczkQZHYaJ6ASg@mail.gmail.com>
 <d360a952-28ae-4d57-bb20-96fd08725a0b@isocpp.org>
 <CAPXezF_JggyMaXjGS9r1EAGVu1NhQBEyGEXB8tKmVqgFfjoCeg@mail.gmail.com>
 <CALJmx62zJd_tZ=XYL7TaSkRN6432SObwH9YS87eLX-h_pMuFYQ@mail.gmail.com>
 <CAOHCbivAK0ypmMhrhJ3zKpF8BHu3h_rUNzeao-HnibJkC-qqGw@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_131_14751153.1359096908050"
X-Trace: ger.gmane.org 1359096912 24577 80.91.229.3 (25 Jan 2013 06:55:12 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 25 Jan 2013 06:55:12 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBTOYRCEAKGQE7PWEV3I@isocpp.org Fri Jan 25 07:55:31 2013
Return-path: <std-proposals+bncBCEKFTV6ZUMBBTOYRCEAKGQE7PWEV3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f199.google.com ([209.85.214.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBTOYRCEAKGQE7PWEV3I@isocpp.org>)
	id 1TydCB-0006kY-TB
	for gclcip-std-proposals@m.gmane.org; Fri, 25 Jan 2013 07:55:28 +0100
Original-Received: by mail-ob0-f199.google.com with SMTP id wc18sf273983obb.10
        for <gclcip-std-proposals@m.gmane.org>; Thu, 24 Jan 2013 22:55:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:date:from:to:message-id
         :in-reply-to:references:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=NQBmWtfUSSjpOGkX11+2R9E7cGpT1q2pvEQR+0F0lZg=;
        b=AO2I5xpongY8V5rTS+Idj9Q6xxFZ4NjfSf9weMlnktUCcvYFpgEwpaAcP4XsPY01y+
         03Gv/XFx7hJDmQOhblG2SfIIh8Or0w9Siy+ATZWVD5nc0jZEO5gbMgpW+EnO/oXwSFsv
         J/7nomWzHfZe2Ih1FV6UbnCymCuRLR7wPkJ45LnzEVemaec7Cz4vqCcM5sO7OdRpDEED
         adxLKqnFD+0ZENrZAkCqtiaPFQgT2+OU6eHDar1dXrali0KJW+kyL9xq3DG089M63VW1
         q/aeNXVUWlH2eY3/1rTLBYVteodqooZ0H9se47uV5H2OFrrqKj+NeWyv0N1gCjVbcQ1c
         0adg==
X-Received: by 10.43.81.196 with SMTP id zz4mr3213432icb.14.1359096909726;
        Thu, 24 Jan 2013 22:55:09 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.195.233 with SMTP id ih9ls225688igc.25.canary; Thu, 24 Jan
 2013 22:55:09 -0800 (PST)
X-Received: by 10.50.149.234 with SMTP id ud10mr1516735igb.11.1359096909056;
        Thu, 24 Jan 2013 22:55:09 -0800 (PST)
In-Reply-To: <CAOHCbivAK0ypmMhrhJ3zKpF8BHu3h_rUNzeao-HnibJkC-qqGw@mail.gmail.com>
X-Original-Sender: jmckesson@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?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:2228
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2228>

------=_Part_131_14751153.1359096908050
Content-Type: text/plain; charset=ISO-8859-1



On Thursday, January 24, 2013 8:56:08 PM UTC-8, Tony V E wrote:
>
> On Thu, Jan 24, 2013 at 7:10 PM, Dean Michael Berris <dbe...@google.com<javascript:>> 
> wrote: 
> > 
> > In my opinion: 
> > 
> > - There's a precedent in other languages for a ".get(default_value)". 
> > Why don't we have this for optional instead? 
> > 
>
> opt.get(17) doesn't look like it is using a default to me.  Typically 
> get(17) is get the 17th element or lookup with key = 17, etc. 
>
>
> > - Why are we forcing pointer semantics on optional? Maybe there's a 
> > different concept here at play. 
> > 
>
> Because much of optional's interface is similar to pointers:  you 
> access the value with *opt and opt can be NULL. 
>
> That is the essential "problem" with optional.  Sometimes it acts 
> value-ish, sometimes pointer-ish.  It is like quantum physics - 
> sometimes a particle, sometimes a wave... 
>

But it doesn't act like a pointer. Indeed, the *only* thing "pointer-ish" 
about it is that it has an `operator*`. In every other way, it acts like a 
value.

If it helps limit confusion, we could get rid of `operator*`.

-- 

--- 
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/?hl=en.



------=_Part_131_14751153.1359096908050
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>On Thursday, January 24, 2013 8:56:08 PM UTC-8, Tony V E wrote:<blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;">On Thu, Jan 24, 2013 at 7:10 PM, D=
ean Michael Berris &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfusc=
ated-mailto=3D"TMEgzGYEbWYJ">dbe...@google.com</a>&gt; wrote:
<br>&gt;
<br>&gt; In my opinion:
<br>&gt;
<br>&gt; - There's a precedent in other languages for a ".get(default_value=
)".
<br>&gt; Why don't we have this for optional instead?
<br>&gt;
<br>
<br>opt.get(17) doesn't look like it is using a default to me. &nbsp;Typica=
lly
<br>get(17) is get the 17th element or lookup with key =3D 17, etc.
<br>
<br>
<br>&gt; - Why are we forcing pointer semantics on optional? Maybe there's =
a
<br>&gt; different concept here at play.
<br>&gt;
<br>
<br>Because much of optional's interface is similar to pointers: &nbsp;you
<br>access the value with *opt and opt can be NULL.
<br>
<br>That is the essential "problem" with optional. &nbsp;Sometimes it acts
<br>value-ish, sometimes pointer-ish. &nbsp;It is like quantum physics -
<br>sometimes a particle, sometimes a wave...
<br></blockquote><div><br>But it doesn't act like a pointer. Indeed, the *o=
nly* thing "pointer-ish" about it is that it has an `operator*`. In every o=
ther way, it acts like a value.</div><br>If it helps limit confusion, we co=
uld get rid of `operator*`.<br>

<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/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_131_14751153.1359096908050--

.
