220 8260 <186E0927-C962-4E34-AED0-E7509DD1F0A0@gmail.com> article
Path: news.gmane.org!not-for-mail
From: Marshall Clow <mclow.lists@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: string_view::is_null()
Date: Fri, 27 Dec 2013 21:01:34 -0800
Lines: 96
Approved: news@gmane.org
Message-ID: <186E0927-C962-4E34-AED0-E7509DD1F0A0@gmail.com>
References: <8045a4d2-721d-4725-8bb7-7a91b6f53ec8@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_18F814F5-564C-478D-85DC-021547C3D448"
X-Trace: ger.gmane.org 1388206943 10897 80.91.229.3 (28 Dec 2013 05:02:23 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 28 Dec 2013 05:02:23 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDHIXP53REBRBYVW7GKQKGQEU5Y2SUQ@isocpp.org Sat Dec 28 06:02:29 2013
Return-path: <std-proposals+bncBDHIXP53REBRBYVW7GKQKGQEU5Y2SUQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gg0-f199.google.com ([209.85.161.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDHIXP53REBRBYVW7GKQKGQEU5Y2SUQ@isocpp.org>)
	id 1Vwm2d-0006Ci-EU
	for gclcip-std-proposals@m.gmane.org; Sat, 28 Dec 2013 06:02:27 +0100
Original-Received: by mail-gg0-f199.google.com with SMTP id e26sf10808626gga.10
        for <gclcip-std-proposals@m.gmane.org>; Fri, 27 Dec 2013 21:02:26 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:mime-version:subject:date
         :references:to:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=DZQ76CjKZpTttB6nI/XxzXaByJdN/J19DgglcjJHk6k=;
        b=iJocP3fmSvx96Fsxzhd0sDBaRieAGoTr98Oiy4KI1Sn30JZTO3j3mrP25SOAkxEOkM
         dR3mifXt3r3D0Ffxpno+R+dFZ+CCYjkfBWkgOojeFf5yuDEFcuHJjh+ALZMQmeTerx9G
         gz7LnjxzRXw2bn+VTpVjZsO56y8ROFoMI8PiTTaMkriZfFoi9DQ6cKu6budR56Yj5ZV+
         l+WimhHbMoWIywYBJtCT0sizIInBnVzjODjz+fevNFAAFJ6xa3dkZx08QVPdVi7iqMPi
         hzLYE8vrpmCDSlve23SAPQk64tfh66vBxR0NT19+VVjVjn6/0eBK5P3immWVCe1eibD/
         Dh8A==
X-Gm-Message-State: ALoCoQnbrd+0hsCdwWx+mszOJMrHW06iVCa72gk02Tbc6m5pUnOnY20r46MvV3RgcdLBi59L+cLd
X-Received: by 10.224.55.81 with SMTP id t17mr21067831qag.3.1388206946489;
        Fri, 27 Dec 2013 21:02:26 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.81.229 with SMTP id d5ls2847285qey.64.gmail; Fri, 27 Dec
 2013 21:02:26 -0800 (PST)
X-Received: by 10.236.152.233 with SMTP id d69mr27473408yhk.11.1388206946006;
        Fri, 27 Dec 2013 21:02:26 -0800 (PST)
Original-Received: from mail-oa0-x229.google.com (mail-oa0-x229.google.com [2607:f8b0:4003:c02::229])
        by mx.google.com with ESMTPS id z21si10209291yhb.74.2013.12.27.21.02.25
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 27 Dec 2013 21:02:26 -0800 (PST)
Received-SPF: pass (google.com: domain of mclow.lists@gmail.com designates 2607:f8b0:4003:c02::229 as permitted sender) client-ip=2607:f8b0:4003:c02::229;
Original-Received: by mail-oa0-f41.google.com with SMTP id j17so10510237oag.0
        for <std-proposals@isocpp.org>; Fri, 27 Dec 2013 21:02:25 -0800 (PST)
X-Received: by 10.182.194.5 with SMTP id hs5mr36520656obc.19.1388206945538;
        Fri, 27 Dec 2013 21:02:25 -0800 (PST)
Original-Received: from [192.168.16.50] (wsip-174-77-164-131.sd.sd.cox.net. [174.77.164.131])
        by mx.google.com with ESMTPSA id qh4sm44040298obc.4.2013.12.27.21.02.23
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 27 Dec 2013 21:02:23 -0800 (PST)
In-Reply-To: <8045a4d2-721d-4725-8bb7-7a91b6f53ec8@isocpp.org>
X-Mailer: Apple Mail (2.1827)
X-Original-Sender: mclow.lists@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of mclow.lists@gmail.com designates 2607:f8b0:4003:c02::229 as
 permitted sender) smtp.mail=mclow.lists@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=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:8260
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8260>

--Apple-Mail=_18F814F5-564C-478D-85DC-021547C3D448
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=windows-1252

On Dec 27, 2013, at 4:52 AM, abolz.lists@gmail.com wrote:

> Is there a reason why string_view is not nullable?
>=20
> Nullable here means default constructed or constructed from a nullptr
> (and a zero length). Then adding a is_null() (or null()) member
> function which can then be used to distinguish the string_view from an
> empty string.

i think that attempting to distinguish between an empty string_view that =
=93used to point at something=94
and an empty string view =93that never pointed at anything=94 is a use case=
 to be discouraged, rather than
something that should be enshrined in the standard.

> This should not affect data() which returns a non-null pointer.
>=20

I disagree here with the proposal as currently written.
I believe that the requirement that data() always return a non-null pointer=
 is misguided.

if sv.size () =3D=3D 0 or sv.empty () [same thing], there is nothing that y=
ou can do with sv.data()
(except compare it to null, and that doesn=92t tell you anything useful).

An empty string view need not point *anywhere*, or have any data behind it.

=97 Marshall

P.S.	In my implementation, I=92m tempted to have a default-constructed stri=
ng_view return a value of 1 from data().

--=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/.

--Apple-Mail=_18F814F5-564C-478D-85DC-021547C3D448
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=windows-1252

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;">On Dec 27, 2013, at 4:=
52 AM, <a href=3D"mailto:abolz.lists@gmail.com">abolz.lists@gmail.com</a> w=
rote:<br><div><br class=3D"Apple-interchange-newline"><blockquote type=3D"c=
ite"><div dir=3D"ltr"><p>Is there a reason why string_view is not nullable?=
</p><div>Nullable here&nbsp;means default constructed or constructed from a=
 nullptr</div><div>(and a zero length). Then adding a is_null() (or null())=
 member</div><div>function which can then be used to distinguish the string=
_view from an</div><div>empty string.</div></div></blockquote><div><br></di=
v>i think that attempting to distinguish between an empty string_view that =
=93used to point at something=94</div><div>and an empty string view =93that=
 never pointed at anything=94 is a use case to be discouraged, rather than<=
/div><div>something that should be enshrined in the standard.</div><div><br=
></div><div><blockquote type=3D"cite"><div dir=3D"ltr"><p>This should not a=
ffect data() which returns a non-null pointer.</p></div></blockquote></div>=
<div>I disagree here with the proposal as currently written.</div><div><div=
>I believe that the requirement that data() always return a non-null pointe=
r is misguided.</div><div><br></div></div><div>if sv.size () =3D=3D 0 or sv=
..empty () [same thing], there is nothing that you can do with sv.data()</di=
v><div>(except compare it to null, and that doesn=92t tell you anything use=
ful).</div><div><br></div><div>An empty string view need not point *anywher=
e*, or have any data behind it.</div><div><br></div><div>=97 Marshall</div>=
<div><br></div><div>P.S.<span class=3D"Apple-tab-span" style=3D"white-space=
:pre">	</span>In my implementation,&nbsp;I=92m tempted to have a default-co=
nstructed string_view return a value of 1 from data().</div><div><br></div>=
</body></html>

<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 />

--Apple-Mail=_18F814F5-564C-478D-85DC-021547C3D448--

.
