220 10437 <e9533cfc-f35c-4313-aaaf-a6d3d8aa00f9@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: maksimpustovoyt@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Add compiler time attributes like c#
Date: Tue, 29 Apr 2014 22:41:08 -0700 (PDT)
Lines: 160
Approved: news@gmane.org
Message-ID: <e9533cfc-f35c-4313-aaaf-a6d3d8aa00f9@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_894_29841539.1398836468280"
X-Trace: ger.gmane.org 1398836477 4712 80.91.229.3 (30 Apr 2014 05:41:17 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 30 Apr 2014 05:41:17 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCRP3Q4MT4MRB5EZQKNQKGQELM3BNMY@isocpp.org Wed Apr 30 07:41:11 2014
Return-path: <std-proposals+bncBCRP3Q4MT4MRB5EZQKNQKGQELM3BNMY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qc0-f198.google.com ([209.85.216.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCRP3Q4MT4MRB5EZQKNQKGQELM3BNMY@isocpp.org>)
	id 1WfNGY-0006Ox-BT
	for gclcip-std-proposals@m.gmane.org; Wed, 30 Apr 2014 07:41:10 +0200
Original-Received: by mail-qc0-f198.google.com with SMTP id r5sf4033349qcx.5
        for <gclcip-std-proposals@m.gmane.org>; Tue, 29 Apr 2014 22:41:09 -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=ZzMWutsuWwZnQMhqDcOFLMWoBY+51uxyViwH7tZw+Qo=;
        b=KeKi05EggrEPPLZdznlmqXbtWh9LolJzmRbuwirFevetZX30vC6yIH07snwIoChhXO
         TgK1cAkSfEilZT55rcPpjNIbH9V0qPjarmVJ96WkDFNzii8EkdYt/BBUnavhmsC0FIKu
         NEPmHi94cVccaG+1SwlRrcqy7Bc+VrKn4CVCVxCerPJnazwx8bFcucwQ0j2lJcg3p/2W
         KHw/EBgAE8o16ZgX8KCMep85H93RIFBQFfXqFUDD048CHmsIMo0iaZOUHu2Fva/jsufL
         uvxg7gfTFv27NLDAkvbbNKPHTKGpToe4MSYblWIrCTZ3hhlW2zDvDzjFhrQOOCQcqdRX
         MJHg==
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=ZzMWutsuWwZnQMhqDcOFLMWoBY+51uxyViwH7tZw+Qo=;
        b=BMimNTpBzlCNdIZhBWmApZp6tTkIgUWZuHmt4Xc+HtXv87f/oYucXGGcyZwH+g9wUi
         u3nq+GtAGOwjcQ+RFNPhJcnxI86fAPOk8om9/cIykN5FPJOz9WagpWayPdxXcE6ANSFJ
         1HbaGmEOjfAX8aQRVzMvgztDomS5DiQOIlgJns3RsX9RiLOrf0tOzs0JtOrUV5rPSCgx
         se7/htOyNN4fAW8Ju5u1jXVJzrIvg+19HmrCxHs5km4NsWMz/0GsQOE2BWJURTy+Ff/Q
         B+Dp99FEg6yV+ezAN2wA4mjWEb/eBTQphc175jzzmc18SwRmvy/ZNPLYn6QkxRVQ1B0j
         /GsQ==
X-Gm-Message-State: ALoCoQkd+pifidkTPxCxjEgtS/ie3BqvKODY+dTkthcC63xVMHrNYv1bn+xeYaMUfPHs8MjygHgX
X-Received: by 10.224.167.8 with SMTP id o8mr1315804qay.0.1398836469577;
        Tue, 29 Apr 2014 22:41:09 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.70.97 with SMTP id l1ls240813obu.58.gmail; Tue, 29 Apr
 2014 22:41:08 -0700 (PDT)
X-Received: by 10.182.243.227 with SMTP id xb3mr14014obc.17.1398836468785;
        Tue, 29 Apr 2014 22:41:08 -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:10437
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10437>

------=_Part_894_29841539.1398836468280
Content-Type: text/plain; charset=UTF-8



Add attribute like a c#:

Example 1:

[ ClsAttr(Name = "MyClassA")]
[ GenerateClassMetaData(true)]
struct TestA {

   [MemberAttr(Name = "A", IsCaseSensitive=false, DefaultValue=234_]
   int A;

   [MemberAttr(Name = "B", IsCaseSensitive=false, DefaultValue=234, 
Range(1,10)) }
   int B;


    [StringFormat("###.#") ]
    [DefaultValue("000.0"]
    string text;

    [MethodAttr(Name="Sum"]
    int Add (
        [Range(0,4)]                                                       
int a, 
        [Arg.Attr(Name="second", DefaultValue =20)]   int b
   )  { return a + b; }    
}
====================================================
..... The compiler will generate static Metadata Object 

               ..........
         printf ( "Class name=%s", TestA::Type::ClsAttr::Name);

....
Also if the class specify [GenerateClassMetaData(true)] attribute the 
compiler will generate static class of meta such as "data members", 
"methods", "constructors", 
For example:
    for (auto  = TestA::Methods.begin(); ) {
      MethodInfo method_info = *it;
      printf("Method name=%s", method_info.Name);


              .........
Also it will provide method to set value such as:
TestA         


====================================================
There will be predefined Attribute classes such as ClsAttr or META_DATA, ...

Also coder can create own:


[ META_DATA]
struct StringArgument {
    string Name;
    string DefValue;
    string Format;
 }


Please see C# Custom attributes for more information














-- 

--- 
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_894_29841539.1398836468280
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div><div><br></div><div>Add attribute like a c#=
:</div><div><br></div><div>Example 1:</div><div><br></div><div>[ ClsAttr(Na=
me =3D "MyClassA")]</div><div>[ GenerateClassMetaData(true)]</div><div>stru=
ct&nbsp;TestA {</div><div><br></div><div>&nbsp;&nbsp; [MemberAttr(Name =3D =
"A", IsCaseSensitive=3Dfalse, DefaultValue=3D234_]</div><div>&nbsp;&nbsp; i=
nt A;</div><div><br></div><div><div>&nbsp;&nbsp; [MemberAttr(Name =3D "B", =
IsCaseSensitive=3Dfalse, DefaultValue=3D234, Range(1,10)) }</div><div>&nbsp=
;&nbsp; int B;</div><div><br></div><div><br></div><div>&nbsp;&nbsp;&nbsp; [=
StringFormat("###.#") ]</div><div>&nbsp;&nbsp;&nbsp; [DefaultValue("000.0"]=
</div><div>&nbsp; &nbsp; string text;</div></div><div><br></div><div>&nbsp;=
&nbsp;&nbsp; [MethodAttr(Name=3D"Sum"]</div><div>&nbsp;&nbsp;&nbsp; int Add=
 (</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Range(0,4)]&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; int a, </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;[Arg.Attr(Name=3D"second", DefaultValue =3D20)]&nbsp;&nbsp; int b</div>=
<div>&nbsp;&nbsp; )&nbsp; { return a + b; }&nbsp;&nbsp;&nbsp; </div><div>}<=
/div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D</div><div>.... The compiler will generate static Metadat=
a Object </div><div><br></div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ..........</div><div>&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf ( "Class name=3D%s", TestA::=
Type::ClsAttr::Name);</div><div><br></div><div>...</div><div>Also if the cl=
ass specify [GenerateClassMetaData(true)] attribute the compiler will gener=
ate static class of meta such as "data members", "methods", "constructors",=
 </div><div>For example:</div><div>&nbsp;&nbsp;&nbsp; for (auto&nbsp;&nbsp;=
=3D TestA::Methods.begin(); ) {</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me=
thodInfo method_info =3D *it;</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prin=
tf("Method name=3D%s", method_info.Name);</div><div><br></div><div><br></di=
v><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; .........</div><div>Also it will provide method to set value suc=
h as:</div><div>TestA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div=
><div><br></div><div><br></div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><div>There will be predefin=
ed Attribute classes such as ClsAttr or META_DATA, ...</div><div><br></div>=
<div>Also&nbsp;coder can create own:</div><div><br></div><div><br></div><di=
v>[ META_DATA]</div><div>struct&nbsp;StringArgument {</div><div>&nbsp;&nbsp=
;&nbsp; string Name;</div><div>&nbsp;&nbsp;&nbsp; string DefValue;</div><di=
v>&nbsp;&nbsp;&nbsp; string Format;</div><div>&nbsp;}</div><div><br></div><=
div><br></div><div>Please see C# Custom attributes for more information</di=
v><div><br></div><div><br></div><div><br></div><div><br></div><div><br></di=
v><div><br></div><div><br></div><div><br></div><div><br></div><div><br></di=
v><div><br></div><div><br></div><div><br></div><div><br></div></div>

<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_894_29841539.1398836468280--

.
