: : 10 posts reached...
: :
: : :
This message was edited by IDK at 2006-6-28 4:13:1
: : : : :
: : : : : There are logical languages that do that completely though, as if your not even programming anymore. I think Prolog is one, I heard of another based on C, but I forgot what it was.
: : : : :
: : : : : Other languages like Java and C# replace pointers with more safe, more innocent "references"
: : : :
: : : :
They are not so innocent. You can still mess up quite a lot when assigning one object to another.
: : : :
: : :
: : :
: : : As gregry tried to explain, references in languages like C# and java are innocent.
: : :
: :
: : I ment those as well. And no, they aren't... this is what I ment:
: :
: : (pseudo code)
: :
: :
: : someFunction(Object byref obj1, Object byref obj2)
: : {
: : obj1 = obj2;
: : }
: :
: :
: : Will the code copy the address or the value here? It is not very obvious and depends on the language. Iirc Java treats common objects in one way and primitive data types + the String object in another way.
: :
: It depends on if the value is saved as a value (what I would call a struct) or as a pointer to a value (what I would call a class).
:
With "byref" I mean that the parameters are passed by reference. But the programmer wants to copy the value from obj2 to obj1. The result would vary depending on language:
C: the address is copied (pointers).
C++: the value is copied. The = operator is called.
Java: the address is copied (unless it is a String iirc)
C#: should be the same as C++?