[phobos] More tuple algorithms with std.meta

Andrei Alexandrescu andrei at erdani.com
Tue Sep 28 14:02:48 PDT 2010


On 9/28/10 13:27 PDT, Philippe Sigaud wrote:
> On Tue, Sep 28, 2010 at 09:50, Shin Fujishiro<rsinfu at gmail.com>  wrote:
>> Philippe Sigaud<philippe.sigaud at gmail.com>  wrote:
>> 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.

I must say that a very healthy approach is to not be extravagant without 
solid use cases. There are lots of things that look cute and interesting 
in this style of programming, and getting carried away is probably the 
#1 risk.

>>   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!

Isn't that as good as Tuple?

> 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!

It's fine if the traction is little in the beginning. There has been 
very little initial traction for some stuff I've done too. Some never 
gained traction, but some did. If it's good, people will notice.


Andrei


More information about the phobos mailing list