From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HEADER_SPAM,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,745ecf6266b2fdbf X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,745ecf6266b2fdbf X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,745ecf6266b2fdbf X-Google-Attributes: gid109fba,public X-Google-Thread: 100850,745ecf6266b2fdbf X-Google-Attributes: gid100850,public X-Google-ArrivalTime: 2003-02-13 12:03:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.visi.com!hermes.visi.com!gemini.plethora.net.POSTED!not-for-mail X-Old-trace: news3.calgary.shaw.ca 1045064222 24.71.223.147 (Wed, 12 Feb 2003 08:37:02 MST) Content-Transfer-encoding: 7BIT References: Content-Type: text/plain; charset=us-ascii X-Trace-postclient-ip: 68.147.131.211 Subject: Re: [ANN] an EBNF parser and coding pattern tool (LGPL) From: Brian Inglis Organization: Systematic Software X-Newsreader: Forte Agent 1.92/32.572 Return-Path: Mime-Version: 1.0 X-Old-complaints-to: abuse@shaw.ca Reply-To: Brian.Inglis@SystematicSw.ab.ca Newsgroups: comp.lang.c.moderated,comp.lang.ada,comp.lang.c,comp.lang.c++ Message-ID: Originator: clcm@plethora.net (Comp Lang C'Moderated) Date: 13 Feb 2003 20:03:15 GMT NNTP-Posting-Host: 7b1bf3ca.news.plethora.net X-Trace: 1045166595 gemini.plethora.net 79562 clcm@205.166.146.1 X-Complaints-To: abuse@plethora.net Xref: archiver1.google.com comp.lang.c.moderated:7430 comp.lang.ada:34071 comp.lang.c:173123 comp.lang.c++:202999 Date: 2003-02-13T20:03:15+00:00 List-Id: On 12 Feb 2003 01:30:42 GMT in comp.lang.c.moderated, Hyman Rosen wrote: >Cedric LEMAIRE wrote: >> The C++ compiler doesn't give you introspection to implement C++ >> templates that work on the composition of a class. > >Yes, this is true. To get this would require support from the >compiler, and I imagine would look something like this - the >result of introspect for some type T would be a class with >informative members, some of which would be like Alexandrescu's >type lists that would carry member and base class information >and could be processed recursively by other templates. We would >also want an equivalent dynamic interface, so that we could take >a polymorphic pointer or reference and deal with its introspection >at runtime. Macros have been used in C for years to generate generic structures and code to process them. Define all the structure member names and types as macro arguments calling a macro that is a parameter of the structure definition macro, with a few extra parameters in each level of macro for code gen arguments, e.g. #define OBJ(B,M,E,X,Y,Z)\ B\ M(int,i,X,Y,Z)\ M(char,c,X,Y,Z)\ E #define TD typedef struct s { #define ETD } s #define TN(t,n,X,Y,Z) t n; #define O(t,n,X,Y,Z) << n OBJ( TD, TN, ETD, , , ); OBJ( cout, O, , , , ); Extend as required. Thanks. Take care, Brian Inglis Calgary, Alberta, Canada -- Brian.Inglis@CSi.com (Brian dot Inglis at SystematicSw dot ab dot ca) fake address use address above to reply abuse@aol.com tosspam@aol.com abuse@att.com abuse@earthlink.com abuse@hotmail.com abuse@mci.com abuse@msn.com abuse@sprint.com abuse@yahoo.com abuse@cadvision.com abuse@shaw.ca abuse@telus.com abuse@ibsystems.com uce@ftc.gov spam traps -- comp.lang.c.moderated - moderation address: clcm@plethora.net