Thread overview
[Issue 4783] New: atomicOp!"^^" doesn't work b/c it doesn't have access to std.math
Sep 01, 2010
David Simcha
Sep 01, 2010
Don
Sep 01, 2010
Don
Sep 01, 2010
David Simcha
Sep 01, 2010
David Simcha
Sep 01, 2010
Don
September 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4783

           Summary: atomicOp!"^^" doesn't work b/c it doesn't have access
                    to std.math
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean@invisibleduck.org
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2010-09-01 07:34:24 PDT ---
import core.atomic;

void main() {
    int num1 = 1;
    int num2 = 1;
    int res = atomicOp!"^^"(num1, num2);
}


Errors:

d:\dmd2\windows\bin\..\..\src\druntime\import\core\atomic.di(96): Error: must
import std.math to use ^^ operator
d:\dmd2\windows\bin\..\..\src\druntime\import\core\atomic.di(6): Error:
template instance core.atomic.atomicOp!("^^",int,int) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4783


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-09-01 07:55:12 PDT ---
That's correct. You need to import std.math if you want to use ^^.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4783



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-09-01 07:59:05 PDT ---
(In reply to comment #1)
> That's correct. You need to import std.math if you want to use ^^.
Oh sorry. Misunderstood. Yes, ^^ should not be used anywhere in core.*

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4783



--- Comment #3 from David Simcha <dsimcha@yahoo.com> 2010-09-01 08:10:51 PDT ---
Then if ^^ isn't going to be usable w/o importing std.math anytime soon, I guess we need to get rid of it from core.atomic.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4783



--- Comment #4 from David Simcha <dsimcha@yahoo.com> 2010-09-01 08:38:37 PDT ---
...or, since the whole thing is based on doing the operation and CASing back the result, we could make a version of atomicOp that takes an arbitrary lambda expression.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4783



--- Comment #5 from Don <clugdbug@yahoo.com.au> 2010-09-01 11:03:58 PDT ---
(In reply to comment #3)
> Then if ^^ isn't going to be usable w/o importing std.math anytime soon, I guess we need to get rid of it from core.atomic.

Yes. Something so high level has no business being in core. pow() for floating point exponents is a *huge* function.

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