220 29389 <CAKO7S=JZi-v=EZiXFmUZnkMxARbVK5EJ6wmnC3NkqT_oSEQjOQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Shi Yan <billconan@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: why not formally support meta programming.
Date: Wed, 9 Nov 2016 12:11:55 -0800
Lines: 202
Approved: news@gmane.org
Message-ID: <CAKO7S=JZi-v=EZiXFmUZnkMxARbVK5EJ6wmnC3NkqT_oSEQjOQ@mail.gmail.com>
References: <668e0a04-c988-4354-ae32-30f626f75403@isocpp.org> <CAOqAUTiRxwtmzM-_tSyTUKbyiJhivCbVmUgQ749ByD=h-SAF4A@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11418c705ea4ba0540e3de7c
X-Trace: blaine.gmane.org 1478722353 26681 195.159.176.226 (9 Nov 2016 20:12:33 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 9 Nov 2016 20:12:33 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD7JLV7X6MLRBDMGR3AQKGQEAYQERGY@isocpp.org Wed Nov 09 21:12:29 2016
Return-path: <std-proposals+bncBD7JLV7X6MLRBDMGR3AQKGQEAYQERGY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f71.google.com ([74.125.82.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBD7JLV7X6MLRBDMGR3AQKGQEAYQERGY@isocpp.org>)
	id 1c4ZDu-00029f-E0
	for gclcip-std-proposals@m.gmane.org; Wed, 09 Nov 2016 21:11:54 +0100
Original-Received: by mail-wm0-f71.google.com with SMTP id r68sf109815466wmd.0
        for <gclcip-std-proposals@m.gmane.org>; Wed, 09 Nov 2016 12:11:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject: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=zikE1YnbZzpnwqdWDwPMV0OV1ge7o5MnN1TBxetuDJs=;
        b=JrR0CZRjd0IsShY+NgHApKuwSwTmZc0QfLspfI7qtrLzKvrZ8D7aov41CcHSYEiXsv
         LFWmckHfXYRc+EBxl5WESTD0ie1U17JIvOU3r8/tRhrtBxl2mBXy5dP4gk3hEJKvvMCJ
         zSKVl1Ir80Brs4OQaF44DDDXJHZaa26aF1RatMxdQ/9ZmbZVzUPmzTS1T+3EKOBvzkpt
         S2MMo4LTBTZpc6mtbnrBNkG8741JkJSrqpC0C1sGtC/jQ4I1tQBs7xr3U6XTrzZQOy8J
         pJpS4si9KLPmDRa0sFW6nxQkQ05VdYil+kLBTfX8bzMlfZMEXAd2zZALuQ8YP6aQU2kp
         XTkw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject: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=zikE1YnbZzpnwqdWDwPMV0OV1ge7o5MnN1TBxetuDJs=;
        b=RHV8NLOpaN/A6cKG4LaZpMnqJqirqHlTT3lP67EamjyrzCyj4N4EZcncNRlbus1bYZ
         HOmBA4iIAubkLs+y9kHuWOkrJFLsBTZPoeLp1NsRp6xqXawGR1WBlcFoxlllsBgwg6tq
         mPyLBAH11RzFwMGle3ILIyj+bb/Mzzdhntr/nD4g9/60MHr53CRll1857781wv4j6A90
         yR/ILKTJ/OE0vxCS8AL7lYtas7bHJG3Cootvu1T8BkaQZHEuHo9Ztk4yIAziyzaeGj1S
         6VrN03H6+uRNOalNr/mfI9dqzOGyyeIrl9AMLkqugiNYDtdjBYTdHjiRhlcOdpJJPkSE
         BuyA==
X-Gm-Message-State: ABUngvcDzeQMWlwH26pCacKvP6RQ+dATOIfV3AUxr8uNx2+mEGUpzVZVXgBN7PN60bhJYA==
X-Received: by 10.28.167.9 with SMTP id q9mr3418797wme.1.1478722317773;
        Wed, 09 Nov 2016 12:11:57 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.18.133 with SMTP id 127ls1288239wms.10.canary-gmail; Wed,
 09 Nov 2016 12:11:56 -0800 (PST)
X-Received: by 10.194.85.107 with SMTP id g11mr1264609wjz.82.1478722316465;
        Wed, 09 Nov 2016 12:11:56 -0800 (PST)
Original-Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com. [2a00:1450:400c:c09::241])
        by mx.google.com with ESMTPS id ga4si1300272wjb.93.2016.11.09.12.11.56
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 09 Nov 2016 12:11:56 -0800 (PST)
Received-SPF: pass (google.com: domain of billconan@gmail.com designates 2a00:1450:400c:c09::241 as permitted sender) client-ip=2a00:1450:400c:c09::241;
Original-Received: by mail-wm0-x241.google.com with SMTP id g23so209253wme.1
        for <std-proposals@isocpp.org>; Wed, 09 Nov 2016 12:11:56 -0800 (PST)
X-Received: by 10.28.125.3 with SMTP id y3mr2387818wmc.30.1478722316049; Wed,
 09 Nov 2016 12:11:56 -0800 (PST)
Original-Received: by 10.28.72.193 with HTTP; Wed, 9 Nov 2016 12:11:55 -0800 (PST)
In-Reply-To: <CAOqAUTiRxwtmzM-_tSyTUKbyiJhivCbVmUgQ749ByD=h-SAF4A@mail.gmail.com>
X-Original-Sender: billconan@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 billconan@gmail.com designates 2a00:1450:400c:c09::241 as permitted sender)
 smtp.mailfrom=billconan@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: <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:29389
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29389>

--001a11418c705ea4ba0540e3de7c
Content-Type: text/plain; charset=UTF-8

So what's the reason for rejection?

On Wed, Nov 9, 2016 at 11:46 AM, Mikhail Maltsev <maltsevm@gmail.com> wrote:

> On Wed, Nov 9, 2016 at 11:32 AM,  <billconan@gmail.com> wrote:
> > I'm trying to design a library for different hardware (CPU and GPU)
> >
> > For users, I want the interface looks like this:
> >
> >
> > Blah<GPU, float> b();
> >
> > or
> >
> > Blah<CPU, double> c();
> >
> >
> > ideally inside the class of Blah, I want to do this to avoid duplication
> and
> > reduce workload:
> >
> >
> >
> > template<DeviceType deviceUsed, typename DataType>
> > class Blah
> > {
> >       DataType shared_member;
> >
> >
> >       #Meta_if(deviceUsed == GPU)   //some kind of meta programming
> syntax
> > to enable code based on template
> >       #{
> >            DataType member_only_used_by_gpu;
> >            void function_on_gpu();
> >       #}
> >
> >
> >       #Meta_if(deviceUsed == CPU)
> >       #{
> >           DataType member_only_used_by_cpu;
> >           void function_on_cpu();
> >       #}
> >
> >
> >
> >
> >       void shared_function()
> >       {
> >             ....
> >             #Meta_if(deviceUsed = GPU) {
> >            ....
> >             #}
> >       }
> > };
> >
> C++17 will have constexpr if. It can be used in a function, but not in
> a class definition. Actually the latter has been proposed earlier, but
> rejected: https://isocpp.org/files/papers/n3613.pdf
>
> --
> Regads,
>    Mikhail Maltsev
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/
> isocpp.org/d/topic/std-proposals/dxjR3T_uGAk/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAOqAUTiRxwtmzM-_
> tSyTUKbyiJhivCbVmUgQ749ByD%3Dh-SAF4A%40mail.gmail.com.
>

-- 
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/CAKO7S%3DJZi-v%3DEZiXFmUZnkMxARbVK5EJ6wmnC3NkqT_oSEQjOQ%40mail.gmail.com.

--001a11418c705ea4ba0540e3de7c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">So what&#39;s the reason for rejection?=C2=A0</div><div cl=
ass=3D"gmail_extra"><br><div class=3D"gmail_quote">On Wed, Nov 9, 2016 at 1=
1:46 AM, Mikhail Maltsev <span dir=3D"ltr">&lt;<a href=3D"mailto:maltsevm@g=
mail.com" target=3D"_blank">maltsevm@gmail.com</a>&gt;</span> wrote:<br><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex"><div class=3D"HOEnZb"><div class=3D"h5">On Wed,=
 Nov 9, 2016 at 11:32 AM,=C2=A0 &lt;<a href=3D"mailto:billconan@gmail.com">=
billconan@gmail.com</a>&gt; wrote:<br>
&gt; I&#39;m trying to design a library for different hardware (CPU and GPU=
)<br>
&gt;<br>
&gt; For users, I want the interface looks like this:<br>
&gt;<br>
&gt;<br>
&gt; Blah&lt;GPU, float&gt; b();<br>
&gt;<br>
&gt; or<br>
&gt;<br>
&gt; Blah&lt;CPU, double&gt; c();<br>
&gt;<br>
&gt;<br>
&gt; ideally inside the class of Blah, I want to do this to avoid duplicati=
on and<br>
&gt; reduce workload:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; template&lt;DeviceType deviceUsed, typename DataType&gt;<br>
&gt; class Blah<br>
&gt; {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0DataType shared_member;<br>
&gt;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0#Meta_if(deviceUsed =3D=3D GPU)=C2=A0 =C2=A0=
//some kind of meta programming syntax<br>
&gt; to enable code based on template<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0#{<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 DataType member_only_used_by_=
gpu;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 void function_on_gpu();<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0#}<br>
&gt;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0#Meta_if(deviceUsed =3D=3D CPU)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0#{<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DataType member_only_used_by_c=
pu;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0void function_on_cpu();<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0#}<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0void shared_function()<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0....<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#Meta_if(deviceUsed =3D=
 GPU) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ....<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#}<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
&gt; };<br>
&gt;<br>
</div></div>C++17 will have constexpr if. It can be used in a function, but=
 not in<br>
a class definition. Actually the latter has been proposed earlier, but<br>
rejected: <a href=3D"https://isocpp.org/files/papers/n3613.pdf" rel=3D"nore=
ferrer" target=3D"_blank">https://isocpp.org/files/<wbr>papers/n3613.pdf</a=
><br>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
--<br>
Regads,<br>
=C2=A0 =C2=A0Mikhail Maltsev<br>
<br>
--<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/dxjR3T_uGAk/unsubscribe" rel=3D"noreferr=
er" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/topic/s=
td-<wbr>proposals/dxjR3T_uGAk/<wbr>unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-proposals+unsubscrib=
e@<wbr>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/CAOqAUTiRxwtmzM-_tSyTUKbyiJhivCbVmUgQ=
749ByD%3Dh-SAF4A%40mail.gmail.com" rel=3D"noreferrer" target=3D"_blank">htt=
ps://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/CAOqAUT=
iRxwtmzM-_<wbr>tSyTUKbyiJhivCbVmUgQ749ByD%<wbr>3Dh-SAF4A%40mail.gmail.com</=
a>.<br>
</font></span></blockquote></div><br></div>

<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/CAKO7S%3DJZi-v%3DEZiXFmUZnkMxARbVK5EJ=
6wmnC3NkqT_oSEQjOQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKO7S%3DJZi-=
v%3DEZiXFmUZnkMxARbVK5EJ6wmnC3NkqT_oSEQjOQ%40mail.gmail.com</a>.<br />

--001a11418c705ea4ba0540e3de7c--

.
