another cool RTInfo trick - i want in runtime

Marco Leise Marco.Leise at gmx.de
Thu Jan 16 23:27:27 PST 2014


Am Fri, 17 Jan 2014 00:15:51 +0000
schrieb "Adam D. Ruppe" <destructionator at gmail.com>:

> On Thursday, 16 January 2014 at 20:16:59 UTC, Marco Leise wrote:
> > It looks like
> > stuff that could only be done with compiler extensions or AST
> > manipulations and yet it works with a simple template.
> 
> Yeah, though remember that it can't actually manipulate the type, 
> it just looks and can build up other data or issue errors, but 
> not change the code it is looking at.

Right. It did get me interested in how UDAs work though, since
I never really looked at them when they were introduced. The
compiler can cope with a lot of template magic I throw at it
now. I'm sure I would have had a dozen errors already with
2.063.
I'm investigating "data driven" library bindings. E.g. some
template contains function pointers with UDAs that describe
how wrappers are to be generated that turn getError() calls
into D exceptions and turn D strings into C char* and similar
tricks, like handling API changes from one version to the next.

-- 
Marco



More information about the Digitalmars-d mailing list