[phobos] RFC: units type for D

Benjamin Shropshire benjamin at precisionsoftware.us
Wed Aug 25 19:19:16 PDT 2010


Don Clugston wrote:
> 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.
>   
Ignoring the point of this being the straw that broke the back of a 
small Phobos, I think that having this is the core lib might result in 
it getting much more usage than the C++ version. If it is just there, 
then anytime people write code that uses physical values, they will be 
MUCH more inclined to use it. I think it would be a heck of a claim for 
D to make that any reasonable D program won't  have any unit errors.

As to the point of what to put in... I am way to biased to say much on that.

Maybe what we need more than a staging ground for Phobos additions is a 
collection of standard add on libs that are officially sanctioned and 
maintained to the same standard as phobose, but are independent of it 
and more or less independent of each other.

> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
>   



More information about the phobos mailing list