[Issue 8588] New: Some troubles with ^^ of arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 25 19:02:51 PDT 2012


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

           Summary: Some troubles with ^^ of arrays
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-08-25 19:02:50 PDT ---
import std.math;
void main() {
    double[3] a = [1.0, 2.0, 3.0];
    double[3] b = a[] ^^ 3; // OK
    double[3] c = [10.0, 20.0, 30.0];
    double[3] d;
    d = (a[] - c[]) ^^ 3; // error
}


DMD 2.061alpha gives:

test.d(7): Error: incompatible types for ((a[] - c[]) ^^ (cast(double)3)):
'double[]' and 'double'


While this shows a problem even with the first form:

import std.math;
void foo(T)(T[] arr) {}
void main() {
    double[3] a = [1.0, 2.0, 3.0];
    foo(a[] ^^ 3);
}


test.d(5): Error: Array operation a[] ^^ 3L not implemented


Someday in D I'd like to be able compute a distance like this:

((v1[] - v2[]) ^^ 2).sum().sqrt();

-- 
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