220 8478 <52CDFB2D.4050703@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: A new keyword for either a type or a variable
 (typical use case for variadic template template)?
Date: Thu, 09 Jan 2014 09:28:13 +0800
Lines: 58
Approved: news@gmane.org
Message-ID: <52CDFB2D.4050703@gmail.com>
References: <f4ec2cca-5951-447f-a938-0b2e5e3e233f@isocpp.org>	<-5123564187529511709@gmail297201516>	<52CB7506.1000906@gmail.com>	<CAOfiQqk4rRTRFX3dbcq33z2C190ZHUGRVUhM0WRJehPZEwFJ8g@mail.gmail.com>	<62bda680-3dd7-4be8-8ac5-0d2e08bf6d99@isocpp.org> <CAOfiQq=fvi-mzf6mP4B2XBgCeHfimX857Jff+Nz=iUeHW5W1nw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
X-Trace: ger.gmane.org 1389230894 19467 80.91.229.3 (9 Jan 2014 01:28:14 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 9 Jan 2014 01:28:14 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBMPWW6LAKGQECFRKCMI@isocpp.org Thu Jan 09 02:28:21 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBMPWW6LAKGQECFRKCMI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f200.google.com ([209.85.214.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBMPWW6LAKGQECFRKCMI@isocpp.org>)
	id 1W14Pz-0002Vo-Uw
	for gclcip-std-proposals@m.gmane.org; Thu, 09 Jan 2014 02:28:20 +0100
Original-Received: by mail-ob0-f200.google.com with SMTP id wm4sf8796829obc.7
        for <gclcip-std-proposals@m.gmane.org>; Wed, 08 Jan 2014 17:28:18 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references: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=CqoBN038h4kb264iAQjNb/yXvGqGNeuJVZ6dEn+LPM0=;
        b=VnVpFkGoIJVuNf19ONKP7hcRPhw5mJFFCNTFTgPc0CvHZ98w+uHBsrlba65+DK/pnx
         PQOjkdYdU/Akl6sLN0O5jb72/jcZHbcXVI1/OFM5y5QlJrTPwIL8obYfRpct2C1DRBxL
         B6Pjt2NFf+vXNvSEyLnFoEIrfpw9Dj08w2ZZEG11HHXIVg+NMhV51X59AVtsml3SiprM
         DUaKnnqi9J/HwvZYqSh+ZRSXrRrm9x06uAqBrRHiIoFwE2eaq7SdvweHlvJ3UDKsN+cp
         8/qDY7TmB9NwBfWLmAsZ4BfYmyX+NOrdnFJ2J/0ykjlxQYgTaQShSChAs5WgMd0BjbB4
         OuSg==
X-Gm-Message-State: ALoCoQn2bTf5+6LTDcWXQ6F3yBJ2bdm4mcLJEScCdObZ7sjrDsGmCQ4hsCzuAO4NjPGiIrqpxtkW
X-Received: by 10.182.241.129 with SMTP id wi1mr176659obc.10.1389230898691;
        Wed, 08 Jan 2014 17:28:18 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.48.105 with SMTP id k9ls741526qen.96.gmail; Wed, 08 Jan
 2014 17:28:17 -0800 (PST)
X-Received: by 10.236.152.233 with SMTP id d69mr409238yhk.11.1389230897809;
        Wed, 08 Jan 2014 17:28:17 -0800 (PST)
Original-Received: from mail-oa0-x22d.google.com (mail-oa0-x22d.google.com [2607:f8b0:4003:c02::22d])
        by mx.google.com with ESMTPS id z48si2869341yha.6.2014.01.08.17.28.17
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 08 Jan 2014 17:28:17 -0800 (PST)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4003:c02::22d as permitted sender) client-ip=2607:f8b0:4003:c02::22d;
Original-Received: by mail-oa0-f45.google.com with SMTP id j17so27484oag.18
        for <std-proposals@isocpp.org>; Wed, 08 Jan 2014 17:28:17 -0800 (PST)
X-Received: by 10.60.52.14 with SMTP id p14mr279709oeo.28.1389230897434;
        Wed, 08 Jan 2014 17:28:17 -0800 (PST)
Original-Received: from Davids-MacBook-Pro.local ([121.54.54.58])
        by mx.google.com with ESMTPSA id g4sm3292290obe.5.2014.01.08.17.28.15
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 08 Jan 2014 17:28:16 -0800 (PST)
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To: <CAOfiQq=fvi-mzf6mP4B2XBgCeHfimX857Jff+Nz=iUeHW5W1nw@mail.gmail.com>
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:4003:c02::22d as permitted
 sender) smtp.mail=potswa@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:8478
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8478>

On 1/9/14 8:44 AM, Richard Smith wrote:
> Here's an implementation:
>
>    template<? X> struct is_type : std::false_type {};
>    template<typename T> struct is_type<T> : std::true_type {};

This appears to be using ? like auto, not to mean "type or object."

Also, as you know, class templates cannot currently be overloaded like 
this. Functions can be, so:

template< typename >
std::true_type is_type();

template< int > // Insufficient generality, to be fixed by "auto"-like 
type deduction.
std::false_type is_type();

template< template< typename ... > class > // Insufficient generality, 
to be fixed by "?"-like kind deduction.
std::false_type is_type();

bool three_is_type = decltype( is_type< 3 >() )::value,
     double_is_type = decltype( is_type< double >() )::value,
     vector_is_type = decltype( is_type< std::vector >() )::value;

> Yes, I think the ? extension alone is sufficient for this.
>
> With the addition of some motivating examples, this seems ready to be
> written up as a paper to me. I'm somewhat optimistic that the most
> contentious part of this will be the syntax ('?' or 'auto' or a new keyword
> or something else).

I still don't see the value of an identifier, as opposed to a pack 
expansion element, that can be either a type or a value. And such a name 
would throw a wrench into template parsing. They could *only* be used as 
explicit template arguments to functions as in my example above, or to 
template template parameters with "?"-like parameter lists.

If you end up needing to use is_type, you're already in deep shit.

On the other hand, parameter lists are already unpacked using 
overloading, or partial specialization which works the same way. This 
gives you a branching point to different code paths for type, value, or 
template, which can already be written and parsed without redesigning 
dependent name lookup.

This is why I think "..." is sufficient with no motivation for "?" or 
any provision for a single argument.

-- 

--- 
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/.

.
