www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8167] New: BigInt(BigInt(1)) too

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

           Summary: BigInt(BigInt(1)) too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I think there's no need to refuse this code:

import std.bigint: BigInt;
void main() {
    auto b1 = BigInt(1);
    auto b2 = BigInt(b1);
}


DMD 2.060alpha gives:

test.d(4): Error: template std.bigint.BigInt.__ctor does not match any function
template declaration
...\dmd2\src\phobos\std\bigint.d(82): Error: template std.bigint.BigInt.__ctor
cannot deduce template function from argument types !()(BigInt)


Currently BigInt contains immutable digits, so that operation is O(1).
GMP supports mutable numbers too for higher efficiency for certain operations,
if BigInt will do the same, then BigInt(BigInt(1)) will create a copy of the
digits.

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