November 08, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9061



--- Comment #13 from bearophile_hugs@eml.cc 2013-11-08 08:17:30 PST ---
(In reply to comment #9)

> I'm starting to think the best solution is to simply disallow bitwise operations that involve both a uint and a BigInt, and this is what I'll implement,

In such cases a strategy to use is ask what the most common use cases are. And look at their expected performance.

If I have code like:
BigInt & 1

And I have to replace it with:
BigInt & BigInt(1)

Or:
BigInt & BigInt.one

What is the performance?


When a design is not clear, a design strategy is to start with a conservative API (disallowing some operations), and only later allow some of them, when you have a better idea of the needs. Allowing more operations later is possible, while restricting an API later is harder and breaks code.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9061



--- Comment #14 from yebblies <yebblies@gmail.com> 2013-11-09 03:43:56 EST ---
(In reply to comment #12)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > *and* sensible.
> > 
> > I'm pretty sure the answer is that it should do the same thing as converting to BigInt, then performing the bitwise operation.
> 
> That means example one is going to break. This is not in line with the principle of least astonishment.

Sure it is:

import std.stdio;

void main()
{
    long a = 0xB16_B16_B16_B16_B16;
    uint b = 0x8000_0000;
    long c = a & ~b;
    writefln("%X", c);
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9061



--- Comment #15 from Simen Kjaeraas <simen.kjaras@gmail.com> 2013-11-08 09:35:43 PST ---
(In reply to comment #14)
> (In reply to comment #12)
> > (In reply to comment #10)
> > > (In reply to comment #9)
> > > > *and* sensible.
> > > 
> > > I'm pretty sure the answer is that it should do the same thing as converting to BigInt, then performing the bitwise operation.
> > 
> > That means example one is going to break. This is not in line with the principle of least astonishment.
> 
> Sure it is:
> 
> import std.stdio;
> 
> void main()
> {
>     long a = 0xB16_B16_B16_B16_B16;
>     uint b = 0x8000_0000;
>     long c = a & ~b;
>     writefln("%X", c);
> }

So it is. I retract my statements and will implement it like that, then.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 23, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9061



--- Comment #16 from safety0ff.bugz <safety0ff.bugz@gmail.com> 2013-11-23 09:01:37 PST ---
(In reply to comment #15)
> So it is. I retract my statements and will implement it like that, then.

Are you working on this?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 24, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9061



--- Comment #17 from Simen Kjaeraas <simen.kjaras@gmail.com> 2013-11-23 17:49:25 PST ---
I am. Expect a pull request within the next ten days.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 26, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9061



--- Comment #18 from Simen Kjaeraas <simen.kjaras@gmail.com> 2013-11-25 16:45:05 PST ---
Ask, and thou shalt receive: https://github.com/D-Programming-Language/phobos/pull/1721

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 06, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=9061


safety0ff.bugz <safety0ff.bugz@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #19 from safety0ff.bugz <safety0ff.bugz@gmail.com> 2014-02-05 17:20:02 PST ---
Fixed: https://github.com/D-Programming-Language/phobos/commit/05738e116c597f17edc13f31c3cda06c38e2239c

If the performance is not satisfactory a new enhancement report should be created.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »