220 10436 <5745d5cb-e5c3-46e5-a1c6-6d767d55dd42@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: maksimpustovoyt@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: code generation by compiler
Date: Tue, 29 Apr 2014 22:20:58 -0700 (PDT)
Lines: 87
Approved: news@gmane.org
Message-ID: <5745d5cb-e5c3-46e5-a1c6-6d767d55dd42@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_3433_17989257.1398835258877"
X-Trace: ger.gmane.org 1398835275 22242 80.91.229.3 (30 Apr 2014 05:21:15 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 30 Apr 2014 05:21:15 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCRP3Q4MT4MRBO4QQKNQKGQEZUDAWEQ@isocpp.org Wed Apr 30 07:21:07 2014
Return-path: <std-proposals+bncBCRP3Q4MT4MRBO4QQKNQKGQEZUDAWEQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vc0-f197.google.com ([209.85.220.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCRP3Q4MT4MRBO4QQKNQKGQEZUDAWEQ@isocpp.org>)
	id 1WfMx3-0002hQ-9T
	for gclcip-std-proposals@m.gmane.org; Wed, 30 Apr 2014 07:21:01 +0200
Original-Received: by mail-vc0-f197.google.com with SMTP id lc6sf4004649vcb.8
        for <gclcip-std-proposals@m.gmane.org>; Tue, 29 Apr 2014 22:21:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id: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=7Bhg3LYepFtwzfCfERgQEiDPmABVkw9tGop5Glqy3+s=;
        b=itefITvzUL1ipADWe3dCSaPPZt0W1kxPdVWqmaf3e0AgK49s/4dhoheHAQEchgoAwS
         Oq0pFHF8aUfruaY0Scfn/53MvYF6t3qGjKEW34iRu2LGq+pxUTXOKrjUXuwfLsaOBr5x
         zdH2Er8UheGRCVTwPjAuDaDiqob12ib6CRJRsqRlZbp56nNvecRHVSm4z6A7b7Ot8XS8
         oLBNnAgge5u9Ng9FX8xuJ0SxyzJKPiqZzGLwEet2gh/5Ly+75+gZRFu1C8g+UTAQKYQE
         S4TRDFgw1JbElovV/69vutaVGQNCkoVUpTNzdym2Z1zngLBlcByK5BP/8qgkWNDc0b7O
         JaUg==
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: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=7Bhg3LYepFtwzfCfERgQEiDPmABVkw9tGop5Glqy3+s=;
        b=IxOjjLQG6EumqXPtrbYXRTKoGgoawH6V0M5Q+Y3b3D/rto8BrUoehtEJXe2kxkYyAN
         bBQxWyeBjKjVfdu7dvJBvJSdgsG54AP7+Hvvp01/uSRXX6hzXOrq0q8EupKFfehxvckb
         Wdj3PycTR7XOlRPSIkXhYVK/6WrYhqN7x/jb7hENrhngdtAqNIaZj6S6sDd0DpbUMsSk
         PQPWK5e696PJNqimSJe/HQYzm+XgfMt6hEYieDB4gfypDiPuD9NZTC9FCbsoGcNOg3R+
         CvIBXuYfQFIujPcPyRKkFYvOX4id5XgLt+VGCuaCZDsHzEflzpDxBQBmOeKK1RTo8Wcu
         oxhw==
X-Gm-Message-State: ALoCoQn1cVWohEiaWeuHQScxvBBFq3Hdh6je76Zm7PWWxdID6nlt2XTTb0ZB42b0LGvEfXfCoDJF
X-Received: by 10.52.112.163 with SMTP id ir3mr1078901vdb.5.1398835260460;
        Tue, 29 Apr 2014 22:21:00 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.142.196 with SMTP id ry4ls219394obb.68.gmail; Tue, 29 Apr
 2014 22:20:59 -0700 (PDT)
X-Received: by 10.182.246.193 with SMTP id xy1mr1120obc.35.1398835259499;
        Tue, 29 Apr 2014 22:20:59 -0700 (PDT)
X-Original-Sender: maksimpustovoyt@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:10436
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10436>

------=_Part_3433_17989257.1398835258877
Content-Type: text/plain; charset=UTF-8

Add the preprocessor directive like below:
#generate (int a, int b, const char * name, .) "source.cpp" -> "include.hpp"

Entry point for source.cpp will be, for example:
 string gen_main( int a, int b, const char *name, const char * prefix = "" 
) {
     ...
     return code_text;
 } 
, where arguments are defined by signature of #generate macro

method must returns code text which will be copy to "include.hpp" file.


So the workflow will be look like :
1) compiler will scan all file for this generate macro...
1) compile "source.cpp" file
2) run the code 
3) write the code_text into target code file, for example "include.hpp"
4) after that this directive will be replaced by #include "include.hpp"
5) compiler start normally ,,


Benefits:
1) This will replace all crazy macro and recursive template 
(metaprogramming)
2) Easy to cache compiler error for generated file
3) Easy maintain and debug (after generation it's just source code)
4) Should be very easy to extend gcc...




-- 

--- 
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_3433_17989257.1398835258877
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Add the preprocessor directive like below:</div><div>=
#generate (int a, int b, const char * name, .) "source.cpp" -&gt; "include.=
hpp"</div><div><br></div><div>Entry point for source.cpp will be, for examp=
le:</div><div>&nbsp;string gen_main( int a, int b, const char *name, const =
char * prefix =3D "" ) {</div><div>&nbsp;&nbsp;&nbsp;&nbsp; ...</div><div>&=
nbsp;&nbsp;&nbsp;&nbsp; return code_text;</div><div>&nbsp;}&nbsp;</div><div=
>, where arguments are defined by signature of #generate macro</div><div><b=
r></div><div>method must returns code text which will be copy to "include.h=
pp" file.</div><div><br></div><div><br></div><div>So the workflow will be l=
ook like :</div><div>1) compiler will scan all file for this generate macro=
....</div><div>1) compile "source.cpp" file</div><div>2) run the code </div>=
<div>3) write the code_text into target code file, for example "include.hpp=
"</div><div>4) after that this directive will be replaced by #include "incl=
ude.hpp"</div><div>5) compiler start normally ,,</div><div><br></div><div><=
br></div><div>Benefits:</div><div>1) This will replace all crazy macro and =
recursive template (metaprogramming)</div><div>2) Easy to cache compiler er=
ror for generated file</div><div>3) Easy maintain and debug (after&nbsp;gen=
eration it's just source code)</div><div>4) Should be very easy to extend g=
cc...</div><div><br></div><div><br></div><div><br></div><div><br></div></di=
v>

<p></p>

-- <br />
<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 <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 />
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_3433_17989257.1398835258877--

.
