On 11/19/10 2:22 AM, spir wrote:
Hum, is this really a transgression of const's promise? Each object's .name fields 
remains unchanged as expected. Rather only the symbolic relations (var-id<-->  
object) change. It's another kind of change.
Here, the 2 facts that the fields are called 'name' and that they hold values 
equal to var-ids, commonly called 'name' as well, just introduce confusion.
What about this, is it also inacceptable?

struct S
{
     const uint code;
}
auto a = S(1); // a<-->  obj1 (code:1)
auto b = S(1); // b<-->  obj2 (code:2)

swap(a, b);
assert(a.code == 2); // a<-->  obj2 (code:2)
assert(b.code == 1); // b<-->  obj1 (code:1)

A const field is expected to always stay the same after being set.

Andrei
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to