Thread overview
[Issue 3832] New: ^^0.5 with no imports
Nov 05, 2010
Don
February 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3832

           Summary: ^^0.5 with no imports
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2010-02-18 12:55:44 PST ---
This doesn't compile and produces many complex error messages, the compiler can't find std.math.sqrt:

void main() {
    double x = 5 ^^ 0.5;
}

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



--- Comment #1 from bearophile_hugs@eml.cc 2010-04-14 13:43:14 PDT ---
With dmd 2.043 that program generates the error messages:

test.d(2): Error: must import std.math to use ^^ operator
test.d(2): Error: undefined identifier module test.std
test.d(2): Error: no property 'math' for type 'void'
Error: no property 'sqrt' for type 'int'
test.d(2): Error: function expected before (), not __error of type int

That can be improved a little (and they are too many).


Don has noted that the implementation of X^^Y when Y is a floating point reqires several function of std.math, and it's not an used frequently operation in D code (on the other hand X^^0.5 is more common, and it just requires sqrt, that doesn't require much code).

So it's possible to require the import std.math when a X^^FP is used. This is not nice, because it seems unnatural to require module imports to use a built-in operator, but it can be an acceptable compromise on a practical basis (if such compromise is adopted, the D documentation has to explain it.)

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-11-05 01:24:54 PDT ---
Fixed DMD2.045

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