220 5994 <dd28049f-916e-4f01-8e12-a842ca8311ff@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: stackmachine@hotmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal: Mixins for C++
Date: Thu, 29 Aug 2013 17:59:59 -0700 (PDT)
Lines: 117
Approved: news@gmane.org
Message-ID: <dd28049f-916e-4f01-8e12-a842ca8311ff@isocpp.org>
References: <787081f7-fb40-4507-907d-259318ef2000@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_159_29370498.1377824399570"
X-Trace: ger.gmane.org 1377824404 5478 80.91.229.3 (30 Aug 2013 01:00:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 30 Aug 2013 01:00:04 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDC7BQ4GSIMRBEG576IAKGQE7L5ZV6Q@isocpp.org Fri Aug 30 03:00:02 2013
Return-path: <std-proposals+bncBDC7BQ4GSIMRBEG576IAKGQE7L5ZV6Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gh0-f199.google.com ([209.85.160.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDC7BQ4GSIMRBEG576IAKGQE7L5ZV6Q@isocpp.org>)
	id 1VFD4E-0004Ge-15
	for gclcip-std-proposals@m.gmane.org; Fri, 30 Aug 2013 03:00:02 +0200
Original-Received: by mail-gh0-f199.google.com with SMTP id g14sf1253786ghb.6
        for <gclcip-std-proposals@m.gmane.org>; Thu, 29 Aug 2013 18:00:01 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        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=e5gI3/t9HHgFckoBit4lEb86EzvXvvbE/9j2Iq8RUuw=;
        b=Z6fjklV7Xr2gHyB8NjGYfA+CwxP3pHkOJ88lHII+3muH6sx0Zw4wEN353w+9WgUylf
         6xMavblkjvNgGkBFBgl9QRSle2KTuTu5K+CizN91K3E8cnLCP4jpBPBZlzJOCbwNM0mT
         +KrGpc1Bi26ECmBK4jI/ufMfZ+askuJXOYQUsIIiTBhy9If6oF5GmGpPTm2ytD4KVYI+
         AF8tIrm5yr6BJSpU6bX3Kg0/aHBMIWTLU32/qs03bpt0M7CKW090MiQAw/hM3Y8jwCtR
         yXUKaAUDYfYRi0QNawcBpXF2tPsMmut82uaca/B0N2qRBp2tPwfU1OK/2L5rW1xHSONp
         /Zcw==
X-Received: by 10.236.109.134 with SMTP id s6mr2182007yhg.32.1377824401085;
        Thu, 29 Aug 2013 18:00:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.70.228 with SMTP id p4ls1134742qeu.43.gmail; Thu, 29 Aug
 2013 18:00:00 -0700 (PDT)
X-Received: by 10.49.12.162 with SMTP id z2mr2333qeb.14.1377824400163;
        Thu, 29 Aug 2013 18:00:00 -0700 (PDT)
In-Reply-To: <787081f7-fb40-4507-907d-259318ef2000@isocpp.org>
X-Original-Sender: stackmachine@hotmail.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:5994
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5994>

------=_Part_159_29370498.1377824399570
Content-Type: text/plain; charset=ISO-8859-1

I very much like this idea. Two things:

   - There has been at least a thread to propose decltype(class) to mean 
   "the type of the current class". This is what __THIS_CLASS__ is supposed to 
   be, with a nice syntax imo.
   - I've had an idea in my head for a long time that seems to be much more 
   flexible than yours. I call it "code generators". 
   The best way to explain this feature is probably using an example.

codegen noncopyable()
{
    emit
    {
        decltype(class)(decltype(class) const&) = delete;
        decltype(class)& operator = (decltype(class) const&) = delete;
    }
}
This thing is not just a macro with better syntax, it is a fully-fledged 
constexpr function that can have compiletime-loops and use compiletime 
reflection to generate code. The only difference to a regular constexpr 
function is that it does not have a return type and instead emits code.

Let's see how this can be used:

struct Foo
{
    $noncopyable() // special call syntax could be using the $-sign or some 
other currently unused character
};
Another idea I had is a special "operator emit" that can be overloaded by 
classes to allow us to carry code around statefully. I have not yet put 
enough thought into this though.


-- 

--- 
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/.

------=_Part_159_29370498.1377824399570
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I very much like this idea. Two things:<br><ul><li>There h=
as been at least a thread to propose decltype(class) to mean "the type of t=
he current class". This is what __THIS_CLASS__ is supposed to be, with a ni=
ce syntax imo.</li><li>I've had an idea in my head for a long time that see=
ms to be much more flexible than yours. I call it "code generators". <br>Th=
e best way to explain this feature is probably using an example.</li></ul><=
p><code></code></p><div class=3D"prettyprint" style=3D"background-color: rg=
b(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bo=
rder-width: 1px; word-wrap: break-word;"><code><code class=3D"prettyprint">=
<div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-=
by-prettify">codegen noncopyable</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>&nbsp; &nbsp; emit<br></span><code><code class=3D"prettyprint"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">&nbsp; &nbsp; {</span></=
code></code><br><code><code class=3D"prettyprint"><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">&nbsp; &nbsp; </span></code></code><code><=
code class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-=
prettify">&nbsp; &nbsp; decltype(class)(decltype(class) const&amp;) =3D del=
ete;<br></span></code></code><code><code class=3D"prettyprint"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">&nbsp; &nbsp; </span></code>=
</code><code><code class=3D"prettyprint"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">&nbsp; &nbsp; decltype(class)&amp; operator =3D (de=
cltype(class) const&amp;) =3D delete;</span></code></code><br><code><code c=
lass=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">&nbsp; &nbsp; }</span></code></code><br><code><code class=3D"prettyprin=
t"><span style=3D"color: #000;" class=3D"styled-by-prettify"></span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"></span></code></code><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></co=
de></div><code>This thing is not just a macro with better syntax, it is a f=
ully-fledged constexpr function that can have compiletime-loops and use com=
piletime reflection to generate code. The only difference to a regular cons=
texpr function is that it does not have a return type and instead emits cod=
e.</code><p></p><p><code>Let's see how this can be used:</code></p><p><code=
></code></p><div class=3D"prettyprint" style=3D"background-color: rgb(250, =
250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-wi=
dth: 1px; word-wrap: break-word;"><code><code class=3D"prettyprint"><div cl=
ass=3D"subprettyprint"><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">struct Foo<br>{<br></span><code><code class=3D"prettyprint"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">&nbsp; &nbsp; </span></cod=
e></code>$noncopyable() // special call syntax could be using the $-sign or=
 some other currently unused character<br><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify"><code><code class=3D"prettyprint"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"></span></code></code>};<br></span=
><span style=3D"color: #660;" class=3D"styled-by-prettify"></span></div></c=
ode></code></div><code>Another idea I had is a special "operator emit"</cod=
e><code> that can be overloaded by classes to allow us to carry code around=
 statefully. I have not yet put enough thought into this though.</code><br>=
<code></code><br><br><p></p></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_159_29370498.1377824399570--

.
