[Issue 5467] library-based typedef

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 1 16:15:45 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=5467


Robert Clipsham <robert at octarineparrot.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |robert at octarineparrot.com


--- Comment #4 from Robert Clipsham <robert at octarineparrot.com> 2012-01-02 00:15:40 GMT ---
(In reply to comment #0)
> 1. Something that's just like another type yet "parallel" with it. This is good
> for abstractions that encode different units of measurement that aren't
> supposed to be mixed.
> 
> ParallelTypedef!double Miles;
> 
> Such a type should accept explicit initialization from a regular double:
> 
> auto dist = Miles(3.2);
> 
> However it shouldn't accept initialization from another parallel typedef:
> 
> ParallelTypedef!double Kms;
> auto dist1 = Kms(4);
> auto dist2 = Miles(dist1); // no

<bikeshed>
This needs a better name, parallel is transitive, so Miles(dist1) should work
(if there are 3 things, A, B and C, A is parallel to B and B is parallel to C,
then A is parallel to C).
</bikeshed>

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list