220 2273 <2c2b9360-8e5e-422d-9b85-124bd947b004@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: Fri, 25 Jan 2013 12:20:36 -0800 (PST)
Lines: 133
Approved: news@gmane.org
Message-ID: <2c2b9360-8e5e-422d-9b85-124bd947b004@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>
 <ef15483d-5665-4da3-9b79-aefd3c725e1b@isocpp.org>
 <CAOHCbithEUfm+w_06V71=hpkqGUJvqiyDFqD7fesfgLy4uUieg@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_144_19398978.1359145236245"
X-Trace: ger.gmane.org 1359145238 26067 80.91.229.3 (25 Jan 2013 20:20:38 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 25 Jan 2013 20:20:38 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBFOSROEAKGQEBRY5PJA@isocpp.org Fri Jan 25 21:20:58 2013
Return-path: <std-proposals+bncBCEKFTV6ZUMBBFOSROEAKGQEBRY5PJA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ia0-f198.google.com ([209.85.210.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBFOSROEAKGQEBRY5PJA@isocpp.org>)
	id 1Typlg-0004VL-3D
	for gclcip-std-proposals@m.gmane.org; Fri, 25 Jan 2013 21:20:56 +0100
Original-Received: by mail-ia0-f198.google.com with SMTP id h23sf1656995iae.9
        for <gclcip-std-proposals@m.gmane.org>; Fri, 25 Jan 2013 12:20:38 -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=HSfU3d+bjIu7Uj8+t7/PTh6OlUHn8Vj1rCx1VN2dSQ8=;
        b=UHWLWYD6KVcytSm6+HG15ie1PGR0WY2vxxmfPXR54E80dafAQ6YXkFM/di5c+sIulT
         Bkj5JlMRnB3VAjyk4mUj2O+OmFLxZQEkMmrXs62RxUQjnWjsB+ZH1sQQOe3QY3pNyNST
         uymYSnUkTqZHR3CJvYx4m2sVytoWUH2fNvlUo1jnsxflLT7nyW/2I7YZR/MP8LL/V2rx
         Oq3QTEzvSFj5oZqloY6+adAEe/+j/YH2f/Q6qOEqPPftrP9QxezQzSsTe6BZ7zFhTMOH
         5Dl6YYJ8ImCcNUnYVZdVus/rQqt13YfBdEHMUfzXAb8JE7I/a8ZchYtlQ3BROWKIPYY0
         FjCw==
X-Received: by 10.42.39.1 with SMTP id f1mr4874262ice.4.1359145238018;
        Fri, 25 Jan 2013 12:20:38 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.197.168 with SMTP id iv8ls642974igc.34.gmail; Fri, 25 Jan
 2013 12:20:37 -0800 (PST)
X-Received: by 10.50.5.174 with SMTP id t14mr2291809igt.11.1359145237359;
        Fri, 25 Jan 2013 12:20:37 -0800 (PST)
In-Reply-To: <CAOHCbithEUfm+w_06V71=hpkqGUJvqiyDFqD7fesfgLy4uUieg@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:2273
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2273>

------=_Part_144_19398978.1359145236245
Content-Type: text/plain; charset=ISO-8859-1



On Friday, January 25, 2013 8:05:06 AM UTC-8, Tony V E wrote:
>
> On Fri, Jan 25, 2013 at 1:55 AM, Nicol Bolas <jmck...@gmail.com<javascript:>> 
> wrote: 
> > 
> > 
> > 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> 
>
> >> 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. 
>
> And can be NULL.
>

No, it can be *empty*, not NULL. `optional` is a container.

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To post to this group, send email to std-proposals@isocpp.org.
To unsubscribe from this group, send email to std-proposals+unsubscribe@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_144_19398978.1359145236245
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>On Friday, January 25, 2013 8:05:06 AM UTC-8, Tony V E wrote:<block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;">On Fri, Jan 25, 2013 at 1:55 AM, Nic=
ol Bolas &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailt=
o=3D"Ep4hNJEqEYIJ">jmck...@gmail.com</a>&gt; wrote:
<br>&gt;
<br>&gt;
<br>&gt; On Thursday, January 24, 2013 8:56:08 PM UTC-8, Tony V E wrote:
<br>&gt;&gt;
<br>&gt;&gt; On Thu, Jan 24, 2013 at 7:10 PM, Dean Michael Berris &lt;<a>db=
e...@google.com</a>&gt;
<br>&gt;&gt; wrote:
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; In my opinion:
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; - There's a precedent in other languages for a ".get(defa=
ult_value)".
<br>&gt;&gt; &gt; Why don't we have this for optional instead?
<br>&gt;&gt; &gt;
<br>&gt;&gt;
<br>&gt;&gt; opt.get(17) doesn't look like it is using a default to me. &nb=
sp;Typically
<br>&gt;&gt; get(17) is get the 17th element or lookup with key =3D 17, etc=
..
<br>&gt;&gt;
<br>&gt;&gt;
<br>&gt;&gt; &gt; - Why are we forcing pointer semantics on optional? Maybe=
 there's a
<br>&gt;&gt; &gt; different concept here at play.
<br>&gt;&gt; &gt;
<br>&gt;&gt;
<br>&gt;&gt; Because much of optional's interface is similar to pointers: &=
nbsp;you
<br>&gt;&gt; access the value with *opt and opt can be NULL.
<br>&gt;&gt;
<br>&gt;&gt; That is the essential "problem" with optional. &nbsp;Sometimes=
 it acts
<br>&gt;&gt; value-ish, sometimes pointer-ish. &nbsp;It is like quantum phy=
sics -
<br>&gt;&gt; sometimes a particle, sometimes a wave...
<br>&gt;
<br>&gt;
<br>&gt; But it doesn't act like a pointer. Indeed, the *only* thing "point=
er-ish"
<br>&gt; about it is that it has an `operator*`. In every other way, it act=
s like a
<br>&gt; value.
<br>
<br>And can be NULL.<br></blockquote><div><br>No, it can be <i>empty</i>, n=
ot NULL. `optional` is a container.<br></div><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 post to this group, send email to std-proposals@isocpp.org.<br />
To unsubscribe from this group, send email to std-proposals+unsubscribe@iso=
cpp.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_144_19398978.1359145236245--

.
