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


Andrei Alexandrescu <and...@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Andrei Alexandrescu <and...@metalanguage.com>  2009-08-28 
09:10:41 PDT ---
The first example creates three empty slices a, b, and c. Then abc is defined
as a slice of slices initialized with those empty slices. Subsequently abc is
filled but the initial slices a, b, and c remain empty. Therefore sort(chain(a,
b, c)) sorts an empty range so it is ineffectual.

The second example (after fixing) works indeed correctly because abc does not
undergo modifications independently from a, b, and c.

The third example is subtle. Assigning to the length of a slice, e.g.

t,length = uniform(8, 17);

may or may not spawn a new allocation (and therefore a divergence of what abc
holds versus what a, b, and c hold individually). Therefore, the behavior will
be erratic depending on what the random number generator yields.

Assigning to length in slices has always had that danger. We have recently
decided to prevent assignable length and defining a separate array type that
has modifiable length.

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

Reply via email to