Copying, Cloning, and Marshalling in .NET
started 3/9/2003; 12:31:50 AM - last post 3/10/2003; 3:56:28 AM
|
|
Ehud Lamm - Copying, Cloning, and Marshalling in .NET
3/9/2003; 12:31:50 AM (reads: 1659, responses: 2)
|
|
Copying, Cloning, and Marshalling in .NET |
still, I find myself wondering about the precise semantics of all the various copying, cloning, and marshalling mechanisms at play in my code.
Good for you! This is a highly important semantic issue, which people tend to misunderstand and label a "small technical detail."
In fact, as more and more languages rely on reference semantics, it becomes more evident that most programmers don't understand the issues involved:
Aliasing is not always a problem, but it can be. It all depends on the interface you expose (i.e., can objects be modified after creation?). Returning a reference type from a function can lead to exposing the representation details of your objects. etc.
It is interesting to see how this fundamental (imperative) semantic issue evolved. Compare, for example, Ada83, C++, Ada95, Java, and now C#.
I can just see myself assigning this as an exercise
Posted to general by Ehud Lamm on 3/9/03; 12:34:15 AM
|
|
|
|
Ehud Lamm - Re: Copying, Cloning, and Marshalling in .NET
3/10/2003; 2:45:29 AM (reads: 748, responses: 0)
|
|
It occurred to me that this issues was first handled manaully, then automatically, and now seen as an attribute of each type (e.g., copy or reference semantics).
|
|
Ehud Lamm - Re: Copying, Cloning, and Marshalling in .NET
3/10/2003; 3:56:28 AM (reads: 755, responses: 0)
|
|
More on how this is related to information hiding, can be found in Liskov's Java book, sec. 5.6.2, Exposing the Rep
|
|
|
|