www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7012] New: Pure vector operations

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7012

           Summary: Pure vector operations
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I think vector ops need to become pure to allow code like:


void main() pure nothrow {
    int[3] a = [1, 2, 2];
    int[3] b = [10, 20, 20];
    immutable int[3] c = a[] + b[];
}


DMD 2.057head gives:

test.d(4): Error: cannot implicitly convert expression (a[] + b[]) of type
int[] to const(immutable(int)[])

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 25 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7012


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx



On latest git HEAD, dmd gives:

test.d(4): Error: Array operation a[] + b[] not implemented

So at least the message is more helpful. But it's still not working yet.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 09 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7012


bearophile_hugs eml.cc changed:

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



This compiles:

void main() pure nothrow {
    int[3] a = [1, 2, 2];
    int[3] b = [10, 20, 20];
    int[3] c = void;
    c[] = a[] + b[];
}


The error message caused by this line of code is not related to purity:

immutable int[3] c = a[] + b[];

So this is closed.

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