220 29442 <08b6d632-c137-b039-9d79-7e67f9ccecfa@honermann.net> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Tom Honermann <tom@honermann.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allowing string literals to match `char...` packs
 in templates
Date: Thu, 17 Nov 2016 10:33:53 -0500
Lines: 114
Approved: news@gmane.org
Message-ID: <08b6d632-c137-b039-9d79-7e67f9ccecfa@honermann.net>
References: <9de07b5f-f870-4a02-882f-54f9fdd12ffd@isocpp.org>
 <CANh8DEm_8ngPVZyMAP4GU8nbvgiD2XxBrLT0M1Pk94m8+tQrug@mail.gmail.com>
 <d9433fac-152f-4515-b518-985a78768c03@isocpp.org>
 <6b73bf50-4189-4d5d-a2c0-2debb085659e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------1ECB6F4A89B94423D6D5BA7C"
X-Trace: blaine.gmane.org 1479396837 16904 195.159.176.226 (17 Nov 2016 15:33:57 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 17 Nov 2016 15:33:57 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.2.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDBNXSHG6UDBBYU3W7AQKGQEFZQXQCA@isocpp.org Thu Nov 17 16:33:52 2016
Return-path: <std-proposals+bncBDBNXSHG6UDBBYU3W7AQKGQEFZQXQCA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f197.google.com ([209.85.192.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDBNXSHG6UDBBYU3W7AQKGQEFZQXQCA@isocpp.org>)
	id 1c7OhE-0003SN-B7
	for gclcip-std-proposals@m.gmane.org; Thu, 17 Nov 2016 16:33:52 +0100
Original-Received: by mail-pf0-f197.google.com with SMTP id 17sf115911637pfy.2
        for <gclcip-std-proposals@m.gmane.org>; Thu, 17 Nov 2016 07:33:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=6RVW5vpCQPga9Vp6OhovgqRNPbJBVhX6aDgLwK5CZxo=;
        b=jWndHCWrp8nkulE5bQ6LgNlgfPDAO97wrPzEK7VSRAz2fWttts4hf1CTrJW4DQQP3H
         ohljYy3aYOqLAFirtcrwDbBWgjKR955bwq0Wj0Zedxp8RC6VBT01t8yXax+p/3ZRj41H
         ddb9ihJ2Q6JyiikuxqoPGhmcyRqYUCYPDG0+Aa2W/valL8resq512jg+m1//bC0BPfy7
         vytrkVk15GDai0hxcTZf2g4YBU8avOD0HQQtfQPBjZXAhdxpaVGyu2CDgVASm5OKSP6M
         vz21Obrb2gwNe6n09d6doQDoeZrrrRC+lyoQKZfEdOnUUAho+bx2eI7iH0gKUEIEhtGW
         ye5Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=6RVW5vpCQPga9Vp6OhovgqRNPbJBVhX6aDgLwK5CZxo=;
        b=FDOQhXIy3qHP3dR6c5vo1vi8ZRWFG0RB7/1BuyH1qssKu+KZiVSKHDalfwjl7Qaz99
         DUcoIO7TuQDonOPYASSLmvYpE2pmQHnawZtMbw5pf6/ckvpAkSNRuoKPkSYU43zh8YIW
         LNAz0tSY5STnuCOzJKaROoT0au/mMjm59AppJwK+AVoc2Urxn5/7L8lS0x96Rwu0rfJw
         hQei2y+SGgsOQSzTPO4WAxbX0dF0FCIA7gg0pz46lJLlNNdpKeaU0F40i5pQnmaSnbrd
         zcfuUoVx7nthwS9cfGtibZ9fZCMG63aLf8z0P1Cr68x2YOPaVZhNaj9aTn264o6MXpaV
         TVCA==
X-Gm-Message-State: ABUngvdVCLHvMVSZZf+irQIn6T5UTRHN7mqidaJFmt8eywZFT7XOiO+c/wkrsz+ECLF7IQ==
X-Received: by 10.99.97.214 with SMTP id v205mr1369394pgb.36.1479396835492;
        Thu, 17 Nov 2016 07:33:55 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.164.73 with SMTP id n70ls1152278ioe.23.gmail; Thu, 17 Nov
 2016 07:33:54 -0800 (PST)
X-Received: by 10.107.1.138 with SMTP id 132mr3342527iob.72.1479396834393;
        Thu, 17 Nov 2016 07:33:54 -0800 (PST)
Original-Received: from smtp91.ord1c.emailsrvr.com (smtp91.ord1c.emailsrvr.com. [108.166.43.91])
        by mx.google.com with ESMTPS id e145si9194472itb.16.2016.11.17.07.33.54
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 17 Nov 2016 07:33:54 -0800 (PST)
Received-SPF: neutral (google.com: 108.166.43.91 is neither permitted nor denied by best guess record for domain of tom@honermann.net) client-ip=108.166.43.91;
Original-Received: from smtp12.relay.ord1c.emailsrvr.com (localhost [127.0.0.1])
	by smtp12.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 24F49C02A9
	for <std-proposals@isocpp.org>; Thu, 17 Nov 2016 10:33:54 -0500 (EST)
X-Auth-ID: tom@honermann.net
Original-Received: by smtp12.relay.ord1c.emailsrvr.com (Authenticated sender: tom-AT-honermann.net) with ESMTPSA id 0678AC02A8
	for <std-proposals@isocpp.org>; Thu, 17 Nov 2016 10:33:53 -0500 (EST)
X-Sender-Id: tom@honermann.net
Original-Received: from [192.168.1.14] (pool-71-176-249-9.rcmdva.fios.verizon.net [71.176.249.9])
	(using TLSv1.2 with cipher DHE-RSA-AES128-SHA)
	by 0.0.0.0:587 (trex/5.7.12);
	Thu, 17 Nov 2016 10:33:54 -0500
In-Reply-To: <6b73bf50-4189-4d5d-a2c0-2debb085659e@isocpp.org>
X-Original-Sender: tom@honermann.net
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 108.166.43.91 is neither permitted nor denied by best guess
 record for domain of tom@honermann.net) smtp.mailfrom=tom@honermann.net
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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:29442
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29442>

This is a multi-part message in MIME format.
--------------1ECB6F4A89B94423D6D5BA7C
Content-Type: text/plain; charset=UTF-8; format=flowed

On 11/17/2016 02:10 AM, TONGARI J wrote:
> What about automatically generating types for string-literals?
> Probably with a built-in literal operator 'lit' that does the compiler 
> magic.
I've given this a little thought.  My motivation comes from wanting to 
know the encoding of a string literal (e.g., implementation defined 
execution character set vs UTF-8).  Presumably, the generated/deduced 
type could record this information.  Such a mechanism would address the 
use cases that motivated P0482R0 
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0482r0.html>.

I think the primary difficulty with such an approach is addressing 
backward compatibility; in particular standard conversions and overload 
resolution.  The generated/deduced type would have to allow implicit 
conversion to an (lvalue) array of code unit type (and then allow 
array-to-pointer decay).  The potential difficulties with specifying 
such behavior are briefly discussed in 
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0482r0.html#design_compat_core.

You're proposal would presumably break the following code unless special 
rules we're introduced to allow a different type deduction for deduced 
pointer types.

auto *p = "text";

Tom.

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/08b6d632-c137-b039-9d79-7e67f9ccecfa%40honermann.net.

--------------1ECB6F4A89B94423D6D5BA7C
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">On 11/17/2016 02:10 AM, TONGARI J
      wrote:<br>
    </div>
    <blockquote
      cite=3D"mid:6b73bf50-4189-4d5d-a2c0-2debb085659e@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">What about automatically generating types for
        string-literals?
        <div style=3D"font-family: arial, sans-serif; font-size: small;">Pr=
obably
          with a built-in=C2=A0<span style=3D"color: rgb(0, 0, 0); font-fam=
ily:
            dejavusans, &quot;dejavu sans&quot;, arial, sans-serif;
            font-size: 12.8px;">literal operator 'lit' that does the
            compiler magic.</span><br>
        </div>
      </div>
    </blockquote>
    I've given this a little thought.=C2=A0 My motivation comes from wantin=
g
    to know the encoding of a string literal (e.g., implementation
    defined execution character set vs UTF-8).=C2=A0 Presumably, the
    generated/deduced type could record this information.=C2=A0 Such a
    mechanism would address the use cases that motivated <a
href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0482r0.htm=
l">P0482R0</a>.<br>
    <br>
    I think the primary difficulty with such an approach is addressing
    backward compatibility; in particular standard conversions and
    overload resolution.=C2=A0 The generated/deduced type would have to all=
ow
    implicit conversion to an (lvalue) array of code unit type (and then
    allow array-to-pointer decay).=C2=A0 The potential difficulties with
    specifying such behavior are briefly discussed in
<a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/jtc1/sc2=
2/wg21/docs/papers/2016/p0482r0.html#design_compat_core">http://www.open-st=
d.org/jtc1/sc22/wg21/docs/papers/2016/p0482r0.html#design_compat_core</a>.<=
br>
    <br>
    You're proposal would presumably break the following code unless
    special rules we're introduced to allow a different type deduction
    for deduced pointer types.<br>
    <br>
    auto *p =3D "text";<br>
    <br>
    Tom.
  </body>
</html>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/08b6d632-c137-b039-9d79-7e67f9ccecfa%=
40honermann.net?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goog=
le.com/a/isocpp.org/d/msgid/std-proposals/08b6d632-c137-b039-9d79-7e67f9cce=
cfa%40honermann.net</a>.<br />

--------------1ECB6F4A89B94423D6D5BA7C--

.
