[phobos] RFC: units type for D

Steven Schveighoffer schveiguy at yahoo.com
Wed Aug 25 21:10:48 PDT 2010


AFAIK there is no solution. I had the same issue with cursors in dcollections.

Sent from my iPhone

On Aug 25, 2010, at 11:15 PM, David Simcha <dsimcha at gmail.com> wrote:

> Ok, I'm working on bit rot repair in my rational library.  Does anyone know of a way, in light of Bug 3659 (http://d.puremagic.com/issues/show_bug.cgi?id=3659) to allow testing two structs for equality when the r.h.s. is an anonymous rvalue or not exactly the same type?  I refuse to commit a library where something this basic doesn't work (especially since I'd have to make things lvalues for no good reason in a zillion places in my unit tests), but it looks like 3659 makes this impossible.
> 
> Also, is there any good reason why BigInt doesn't overload cast operators?  Should I fix this?  IMHO cast(long) someBigInt should work especially since BigInt already has a .toLong() method.
> 
> On 8/25/2010 10:58 PM, Andrei Alexandrescu wrote:
>> This is a very interesting discussion, with great points. Here's what I think - in brief, my experience time and again has been that stuff that has a strong champion behind it succeeds, and stuff that doesn't, doesn't. In light of that, if Benjamin and/or David are enthused about pushing their libraries into Phobos, and furthermore maintaining and enhancing them, and further-furthermore contributing in new ways to Phobos, then I think it's not crucial that dimensional analysis (and possibly rational numbers) are of narrow utility.
>> 
>> One less positive example is std.json - after adding it to Phobos, Jeremie didn't hang around to maintain it, bring its style on par with the rest of Phobos etc. Right now it's a library in need of a champion. Not to mention the likes of std.xml :o).
>> 
>> So, subject to the rest of the team being approving too, I'd say let's give dimensional analysis (and rational numbers too if David wants) a fair shot at inclusion in Phobos. Be prepared for ruthlessness though :o).
>> 
>> 
>> Andrei
>> 
>> On 8/25/10 19:37 PDT, David Simcha wrote:
>>> One comment I want to make is that, if we're going to include this, I
>>> have a rational number library on Scrapple that I've been meaning to put
>>> up for review for a while. I noticed that you roll your own somewhat
>>> ad-hoc rational numbers for the units type and don't really expose them
>>> in any more general way. IMHO if both rational and the units lib make
>>> the cut for Phobos, they should be integrated with each other. I'll
>>> clean up my rational library and do a commit, since it's succumbed to
>>> some degree of bit rot. It's at
>>> http://dsource.org/projects/scrapple/browser/trunk/rational/rational.d.
>>> 
>>> On 8/25/2010 10:09 AM, 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?)
>>>> _______________________________________________
>>>> phobos mailing list
>>>> phobos at puremagic.com
>>>> http://lists.puremagic.com/mailman/listinfo/phobos
>>>> 
>>> 
>>> _______________________________________________
>>> phobos mailing list
>>> phobos at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>> 
> 
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list