Preliminary submission - std.rational and std.typelist

David Nadlinger see at klickverbot.at
Sat Oct 6 10:58:35 PDT 2012


On Saturday, 6 October 2012 at 17:56:39 UTC, Arlen wrote:
> Hopefully nobody has ported Boost.Units to D.

I wrote a units library in D last year: 
http://klickverbot.at/code/units/. Before setting out, I 
extensively researched existing solutions in other languages, 
Boost.Units being on of them, and I believe that I managed to 
come up with a design which takes advantage of D's advanced 
metaprogramming capabilities, and as such is more powerful while 
being much less clunky.

For example, in comparison to Boost.Units, I didn't introduce a 
notion of "dimension" separate from the concept of units, which 
seemed to ultimately serve no purpose besides making valid 
conversions easier to determine given the limitations of C++. I'd 
love to hear your comments on the design!

There didn't seem much interest in it back then, but I know 
Andrei and a few others would like to see something like it in 
Phobos. It is pretty much finished, but needs a bit of polish 
here and there (many compiler improvements have been made since I 
wrote it). Unfortunately, I'm currently swamped in other work, 
though…

> std.typelist, which provides the TypeList type and several 
> metafunctions.  The metafunctions are pretty much stolen from 
> Haskell.  
> Source: 
>  https://github.com/Arlen/phobos/blob/units/std/typelist2.d
> Docs:  http://arlen.github.com/phobos/std_typelist2.html

What are the real benefits of this over std.typetuple? We 
recently discussed what to do with std.typelist, which, as you 
noticed, has been bitrotting without being included in the 
official documentation. As far as I remember, there was consensus 
that having another implementation of "compile-time tuples" 
besides std.typetuple is not something we really want to do.

David


More information about the Digitalmars-d mailing list