On Tue, Sep 28, 2010 at 09:50, Shin Fujishiro <[email protected]> wrote: > Philippe Sigaud <[email protected]> wrote: >> I'm willing to review your code. I also feel Phobos should showcase D >> metaprogramming on types. At a minimum, filtering, reducing, scanning >> (reduce with history), rotating and inverting tuples should be there. > > Thanks! Please note: D metaprogramming is not only on types, but also > on symbols and compile-time constants - possibly combined with mixins.
That's OK with me. What about I read and comment on your code before the end of the week? (Err, make that the very end of the week) > > I mean, static tuple algorithms should be able to handle tuples composed > of heterogeneous entities: types, symbols and/or constants. Agreed. Ok, any compile-time sorcery on template-y arguments tuples. > It will > allow us to write something like follows in a short, functional style: > > Struct!(int, "x", double, "y") > http://gist.github.com/600535 Nice! (I'd have filtered TypeNames to get types in a tuple and names in another, instead of striding TypeNames. But I say that only because I'm jealous of what you've done :) ) > (dranges.templates is interesting, too.) having templates acting on templates is fun :) It's easy to do, too: meta-meta-programming, something that would have blown my mind in C++ :) > > As for the separation of typetuple and variadic... As I mentioned > above, I think static tuple algorithms should be able to work with > heterogeneous tuples. Limiting algorithms only on types is not a > choice for me. OK. I indeed did them initially only as a way to generate types, when I was having troubles with auto. > > But it does *not* mean I think the variadic is useless! Note that I'm > talking about compile-time operation on template tuple parameters; > std.variadic algorithms would be definitely useful in run-time code. Banco for a separation between 'acting on tuples at CT' on one hand and 'acting on tuples at runtime' on another. > variadicMap is especially a gem! Thanks. That's strange, D has wonderfully powerful metaprogramming abilities, but no one seems to care. How many languages can offer a statically checked mapping of a polymorphic function on a heterogeneous list, in a few lines of code? And it's not just an esoteric goal: you can transform structs.tupleof or function arguments as you wish! Philippe _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
