In, inout, out, and damn lies....

Bruno Medeiros daiphoenixNO at SPAMlycos.com
Fri Feb 24 12:43:32 PST 2006


Derek Parnell wrote:
 > On Sun, 19 Feb 2006 04:29:50 +1100, Bruno Medeiros
 > <daiphoenixNO at SPAMlycos.com> wrote:
 >
 >> In C++ the reference types are all explicit pointers, so it is more
 >> clear what the values of the types are.
 >>
 >> This is the standard definition for a good reason. It is a more
 >> simple/symmetric/orthogonal one (although the terminology is still
 >> quite tricky).
 >
 > And by 'tricky' you mean 'stupid' right?
 >
No.

 > If one passes the address of an int to a function, is it passing a
 > reference or value or data or what? Dumb question, no?
 >
It is like Ivan said.

 > --Derek Parnell
 > Melbourne, Australia

> 
> 
> [snip]
> 
>> Here is the main point of contention. The value of a reference type is 
>> not it's referenced data, but it's reference/pointer itself. I.e. the 
>> value of a class variable is it's reference, not it's referenced 
>> instance data.
>>
>> .NET Common Type System Overview :
>> http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcommontypesystemoverview.asp 
>>
>> "Values are binary representations of data, and types provide a way of 
>> interpreting this data. A value type is stored directly as a binary 
>> representation of the type's data. The value of a reference type is 
>> the location of the sequence of bits that represent the type's data."
>>
>> Java Types, Values, and Variables:
>> http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html 
>>
>> "The types of the Java programming language are divided into two 
>> categories: primitive types and reference types. [...] An object 
>> (§4.3.1) is a dynamically created instance of a class type or a 
>> dynamically created array. The values of a reference type are 
>> references to objects."
> 
> Welcome to the world of Alice. It seems that the good and intelligent 
> people at Microsoft and Sun and taken perfectly good English word and 
> redefined it to make it easier to sell their product. It like I gave you 
> an ISBN and told you that I've really given you the book.
> 
> Ok, assuming their perverted definition of 'value', it boils down to 
> saying that when passing parameters to a function, the function is 
> getting something that enables the function to access the parameter's 
> data. Really? Who would have guessed that!
> 
 > Well, I'm afraid I'm continue to be a rebel and refuse to bow down to
 > these mighty organizations and their mock-turtles.

Perverted definition of 'value'? That's very subjective and very 
arguable, and I disagree with it. I think the Java and C# engineers 
chose the appropriate definition, regardless of corporate interests 
(uh... in fact, how does a 'perverted' definition of value makes it any 
easier to sell their products at all?..).
*Actually*, saying they "chose" is misleading, because this is something 
that just immediately and naturally follows from the C/C++ language 
roots, and thus not even related to any possible corporate greediness. 
Indeed, and I regret not having remembered this earlier, in Kernighan 
and Ritchie's "The C Programming Language", it is said, is the first 
paragraph of page 99, that "By definition, the value of a variable or 
expression of type array is the address of element zero of the array.", 
so there ya go.

Anyway, I'm starting to get bit dizzy now.


-- 
Bruno Medeiros - CS/E student
"Certain aspects of D are a pathway to many abilities some consider to 
be... unnatural."



More information about the Digitalmars-d mailing list