Metaprogramming in D : Some Real-world Examples

Bill Baxter wbaxter at gmail.com
Thu Nov 12 03:10:42 PST 2009


2009/11/10 Denis Koroskin <2korden at gmail.com>:
> On Tue, 10 Nov 2009 03:27:20 +0300, Bill Baxter <wbaxter at gmail.com> wrote:
>
> kprintf (a printf variant) in XoMB is a nice example imo. It accepts format
> as a template parameter, doing all the checks at compile-time (and more).
>
> http://github.com/xomboverlord/xomb-bare-bones/blob/6d924a9fd7cafe43aa50f38c0cd04c44187d4993/kernel/core/kprintf.d
>

Nice.  400 lines is a little long for this purpose, though.  Maybe a
somewhat simplified version that just replaces {} with template args
would be good.  I guess that's pretty much what std.metastrings.Format
does, just with %s instead of {}.

--bb


More information about the Digitalmars-d-announce mailing list