[Swift-devel] aliasing/copying

Mihael Hategan hategan at mcs.anl.gov
Fri Oct 16 17:02:39 CDT 2009


In r3170 I added an implementation for (some) mapped-type assignments.

This is an implementation for the following types of code:
a = b;

If a has a mapper supporting remapping (i.e. being told to map something
to something after being initialized), then the effect is that of 'a'
being a soft copy of 'b'. I implemented remapping support for the
concurrent mapper.

If a has a mapper that doesn't support remapping, b's file is copied to
a's file.

So:
1, 
file a <"test.txt">;
file b;
b = a;
trace(@filename(b))

Will result in "SwiftScript trace: test.txt"

2.
file a <"test.txt">;
file b <"echo.txt">;
b = a;
trace(@filename(b))

Will result in "SwiftScript trace: echo.txt" and the contents of
"test.txt" copied to "echo.txt".

I have not run integration tests on this. It would be helpful if someone
could.




More information about the Swift-devel mailing list