Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!sdd.hp.com!hplabs!hpcc05!hpcuhb!hpda!hpcupt1!thomasw From: thomasw@hpcupt1.cup.hp.com (Thomas Wang) Newsgroups: comp.object Subject: value semantic versus reference semantic Message-ID: <68780001@hpcupt1.cup.hp.com> Date: 6 May 91 17:45:59 GMT Organization: Hewlett Packard, Cupertino Lines: 24 I am looking at the issues of value semantic versus reference semantic. The value semantic says that a := b; means the value of 'b' is copied to 'a'. The reference semantic says that a := b; means 'a' is pointing to the same place as 'b'. It has occurred to me that value semantic is equivalent to reference semantic if the value of 'b' can never change. So one can use reference semantic on immutable classes, and expect them to be well behaved. However, it seems the running speed of program using immutable classes can be slower than an equivalent program using mutable classes, since so many garbage objects can be generated by the immutable version. The question is 'are there optimization algorithms that can improve the performance of immutable classes?' -Thomas Wang (Everything is an object.) wang@hpdmsjlm.cup.hp.com thomasw@hpcupt1.cup.hp.com