[phobos] RFC: units type for D

Don Clugston dclugston at googlemail.com
Wed Aug 25 17:14:27 PDT 2010


On 26 August 2010 00:26, Benjamin Shropshire
<benjamin at precisionsoftware.us> wrote:
> Hello Walter,
>
>> Benjamin Shropshire wrote:
>>
>>> I have offered up a library that supports statically encoding units
>>> in the type system so as to prevent unit errors (adding distance and
>>> time) and to enforce correct conversions all around.
>>>
>>> http://d.puremagic.com/issues/show_bug.cgi?id=3725
>>>
>>> I'm looking for comments: What's holding it back from inclusion? What
>>> would need to be improved? The API? Better comments? (I haven't
>>> tested it recently so; make it build again?)

I have significant concerns about this, though not related to the code
itself. It's an excellent test case for the template system, and it's
something the language needs to be able to do. However, my feeling is
that this is really quite niche. I've seen a few implementations of
the idea in C++, but I've not seen much evidence that anyone actually
uses it. I fear it might be a solution in search of a problem.
Does it really belong in the core library?
Partly this comes back to the question of how big we expect Phobos to
eventually become. If it were already hundreds of modules, there
wouldn't be much question. But to my mind, including this code would
mean we're committing to an enormous Phobos. I don't think we're ready
for that yet.


More information about the phobos mailing list