www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8588] New: Some troubles with ^^ of arrays

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Aug 25 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8588


bearophile_hugs eml.cc changed:

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



Sorry, a dupe of mine...

*** This issue has been marked as a duplicate of issue 10306 ***

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