> At 6:56 PM +0530 1/4/03, Gopal V wrote: >>If memory serves me right, Erik Bågfors wrote: >>> > >> would a be able to modify itself ? (unfortunately C# allows >>> that) >>> > > >> >>To clarify here's my example ... >> >>=cut >> >>using System; >>public struct MyStruct >>{ >> int val; >> public MyStruct(int x){ val=x; } >> public void Modify(){ val=42; } >> public override String ToString(){ return val.ToString(); } >>} >>public class FooBar >>{ >> public static void Main() >> { >> MyStruct m1=new MyStruct(10); >> MyStruct m2=m1; >> m1.Modify(); >> Console.WriteLine(m1); >> Console.WriteLine(m2); >> } >>} >> >>=end cut >> >>Which gives >> >>42 >>10 >> >>If in anycase Parrot wants to avoid this , we could always add a >> special case to the ILNode_Assign to generate an explicit copy step in >> parrot for valuetypes... > > Why would we want to avoid this? It looks exactly like what ought to > happen.
I think he was explaining what he meant in another post that someone questioned, with this example; then the "wants to avoid this" referred to "avoiding the easy-path error of NOT doing this". I think Gopal was saying that C#/NET does it that way, and I can't imagine him asking to have functionality he explicitly needs to be "carefully avoided" :) OTOH, I may have misread a bunch of things, I'm not doing so hot on my interpretations the last few days :o --attriel