[Issue 9656] Built-in dup result should behave as like unique array, if it is possible.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 10 05:54:51 PDT 2013


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


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies at gmail.com
         Resolution|                            |FIXED


--- Comment #7 from yebblies <yebblies at gmail.com> 2013-05-10 22:54:50 EST ---
> I am ignorant regarding the compiler, but ,aybe in the meantime it's enough to
> have an invisible "unique" attribute used just by the compiler-front end, like
> the various PUREimpure, PUREfwdref, etc used in the compiler.

So far we've been going in the direction of 'unique expressions' whereby the
fact they allocate new memory or call pure functions etc is enough to ensure
they are unique.

The funny thing about this one is that this function:

int[] dup(const(int)[] data) pure
{
    return data.dup;
}

was already creating a unique result, while the builtin was not.  (I haven't
tested that exact code, but something along those lines should work)

The purity+allocation pattern for normal functions should allow many library
types to create unique data, without needing additional attributes.

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