220 8599 <1140684e-4619-4b14-9e0e-fdb30d830333@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Olaf van der Spek <olafvdspek@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: string_view::is_null()
Date: Wed, 15 Jan 2014 04:20:11 -0800 (PST)
Lines: 119
Approved: news@gmane.org
Message-ID: <1140684e-4619-4b14-9e0e-fdb30d830333@isocpp.org>
References: <8045a4d2-721d-4725-8bb7-7a91b6f53ec8@isocpp.org> <186E0927-C962-4E34-AED0-E7509DD1F0A0@gmail.com>
 <CANh-dXkOyaq0U9MkYiiZeTTMcNVNXVG6vqqwBOCymXLHpV1VJg@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_299_27037740.1389788411800"
X-Trace: ger.gmane.org 1389788408 14833 80.91.229.3 (15 Jan 2014 12:20:08 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 15 Jan 2014 12:20:08 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5NB45SSABBB7HZ3GLAKGQEXAQFNDI@isocpp.org Wed Jan 15 13:20:15 2014
Return-path: <std-proposals+bncBC5NB45SSABBB7HZ3GLAKGQEXAQFNDI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f200.google.com ([209.85.223.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC5NB45SSABBB7HZ3GLAKGQEXAQFNDI@isocpp.org>)
	id 1W3PS9-0002rf-RR
	for gclcip-std-proposals@m.gmane.org; Wed, 15 Jan 2014 13:20:14 +0100
Original-Received: by mail-ie0-f200.google.com with SMTP id lx4sf5868966iec.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 15 Jan 2014 04:20:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to: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=8NR1AUktwON3tU74uZ1xkXGiyTcuyaMEQquj3zWIWKg=;
        b=YqeRCibt3TZfnYYPDDIOkimBTwKlavQDw0NIouVd6jr3Ic64W9OU3qmrvZ+Zrqa7mb
         gdq2l04gTBkaL4FqCWOsIeSYGxEAuyg+1DCYzrPulS3aLuQrrvQM/zb2nPmED2Wfu+2v
         Mhr26D2mQ9e933uy+ICsY5/aese89siXx6ADK7Mmi3pYGt96sQzLmniRKcBP9HYRujtt
         6QyScM2DVjGlXMZl0DntKhu+R4zpRv6beDxloVO5LaI9hTcOWh+RH4d4bKH5zvKEvPzw
         Fvwor6EG/GBbpxmLhHN9tjZ7IzO/m1Fkno3oFWK4D6Fmkmp+6SzmE+x0Ug0COPvkraTA
         YAWQ==
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:x-original-sender:reply-to:precedence
         :mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=8NR1AUktwON3tU74uZ1xkXGiyTcuyaMEQquj3zWIWKg=;
        b=OahcxTcdFd8gVUz4Z13MH9aJwzmTbYytL36K78hoJtMXVEGPc945dkymSm0yNSkzNo
         gQN8vxmy+87n0HgOZWnr5TqrzpfX4YNKRmpfmDqwYcUfUF+dbIWh7aA3q7AFMzo9d6lP
         eGaKr+ntSeF8d1Z7fjpiB5YIa7c/TerCdIFyDHZZtBIpTuMws6CdIBihxpsTmPaWfwBh
         FUpwj+2gbQFib2jt7MedLZfOXjzdPtJLDcPSUyjbv8cLcvXwlL3SII2RiEBOwQgph8td
         8GXlyyWXgr9yFSiik41pbE+BN/PHJamEWtgoFWxFl7KXi4Brj2luIZvdswR9hiIV9znd
         RBgg==
X-Gm-Message-State: ALoCoQnppaTaxQpBWooJ9HLB5TZ2yuP0RdckZx/G6n2eZ/XrNWXCsw4cTY0UZe/W8duvpDLMmLqG
X-Received: by 10.43.161.202 with SMTP id mh10mr560890icc.23.1389788412926;
        Wed, 15 Jan 2014 04:20:12 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.48.105 with SMTP id k9ls532055qen.96.gmail; Wed, 15 Jan
 2014 04:20:12 -0800 (PST)
X-Received: by 10.49.17.98 with SMTP id n2mr35875qed.19.1389788412426;
        Wed, 15 Jan 2014 04:20:12 -0800 (PST)
In-Reply-To: <CANh-dXkOyaq0U9MkYiiZeTTMcNVNXVG6vqqwBOCymXLHpV1VJg@mail.gmail.com>
X-Original-Sender: olafvdspek@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:8599
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8599>

------=_Part_299_27037740.1389788411800
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Saturday, December 28, 2013 6:59:37 PM UTC+1, Jeffrey Yasskin wrote:
>
> i think that attempting to distinguish between an empty string_view that=
=20
>> =E2=80=9Cused to point at something=E2=80=9D
>> and an empty string view =E2=80=9Cthat never pointed at anything=E2=80=
=9D is a use case=20
>> to be discouraged, rather than
>> something that should be enshrined in the standard.
>>
>> This should not affect data() which returns a non-null pointer.
>>
>> I disagree here with the proposal as currently written.
>> I believe that the requirement that data() always return a non-null=20
>> pointer is misguided.=20
>>
>
>> if sv.size () =3D=3D 0 or sv.empty () [same thing], there is nothing tha=
t you=20
>> can do with sv.data()
>> (except compare it to null, and that doesn=E2=80=99t tell you anything u=
seful).
>>
>
> The thing is, if nullptr is a possible return value for data(), people do=
=20
> start using it to convey information. If they get a null out exactly when=
=20
> they put a null in, it is telling them something useful. The only way to=
=20
> "discourage" it is to make it never happen. If we let string_view::data()=
=20
> pass through null, we're enshrining the use you don't like in the standar=
d.
> =20
>
In some cases being able to distinguish between null and empty is required.=
=20
string_view could easily support this distinction, what's the reason it=20
should be discouraged?

optional<string_view> is an obvious suggestion but that increases code=20
complexity at the call site when the distinction is not required.

--=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_299_27037740.1389788411800
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Saturday, December 28, 2013 6:59:37 PM UTC+1, Jeffrey Y=
asskin wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
<div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style=
=3D"word-wrap:break-word"><div>i think that attempting to distinguish betwe=
en an empty string_view that =E2=80=9Cused to point at something=E2=80=9D</=
div>

<div>and an empty string view =E2=80=9Cthat never pointed at anything=E2=80=
=9D is a use case to be discouraged, rather than</div><div>something that s=
hould be enshrined in the standard.</div><div><div><br></div><div><blockquo=
te type=3D"cite">

<div dir=3D"ltr"><p>This should not affect data() which returns a non-null =
pointer.</p></div></blockquote></div></div><div>I disagree here with the pr=
oposal as currently written.</div><div><div>I believe that the requirement =
that data() always return a non-null pointer is misguided.&nbsp;</div>

</div></div></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style=3D"word-=
wrap:break-word"><div><div><br></div></div><div>if sv.size () =3D=3D 0 or s=
v.empty () [same thing], there is nothing that you can do with sv.data()</d=
iv>

<div>(except compare it to null, and that doesn=E2=80=99t tell you anything=
 useful).</div></div></blockquote><div><br></div><div>The thing is, if null=
ptr is a possible return value for data(), people do start using it to conv=
ey information. If they get a null out exactly when they put a null in, it =
is telling them something useful. The only way to "discourage" it is to mak=
e it never happen. If we let string_view::data() pass through null, we're e=
nshrining the use you don't like in the standard.</div>

<div>&nbsp;</div></div></div></div></blockquote><div>In some cases being ab=
le to distinguish between null and empty is required. string_view could eas=
ily support this distinction, what's the reason it should be discouraged?</=
div><div><br></div><div>optional&lt;string_view&gt; is an obvious suggestio=
n but that increases code complexity at the call site when the distinction =
is not required.</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_299_27037740.1389788411800--

.
