Re: Question of JAVA programmer to C# programmers
Bjorn Abelli <bjorn_abelli@D oNotSpam.hotmai l.com> wrote:
<snip stuff we agree about>
[color=blue]
> It is whether the value of the variable is the actual value, or a reference
> to the value, that decides if it's a "value type" or a "reference type". Not
> necessarily the type itself.[/color]
I disagree. If you're talking about boxing etc, then there are actually
two types for each value type: there's the value type itself and the
reference type. An object has a type regardless of whether it's in a
variable somewhere or not.
[color=blue]
> That it coincides in .NET with structs vs classes as well as in Java with
> primitive types vs classes is something else, made for convenience.
>
> If we lift the concepts above the actual languages and platforms it could be
> something else. For example, if you define a class or a struct in C++, they
> are by themselves neither value nor reference types.[/color]
If it's a .NET type then it is deinitely one or the other though. I
believe this is one of those topics where it doesn't make sense to talk
details without reference to the particular platform involved.
--
Jon Skeet - <skeet@pobox.co m>
If replying to the group, please do not mail me too
Bjorn Abelli <bjorn_abelli@D oNotSpam.hotmai l.com> wrote:
<snip stuff we agree about>
[color=blue]
> It is whether the value of the variable is the actual value, or a reference
> to the value, that decides if it's a "value type" or a "reference type". Not
> necessarily the type itself.[/color]
I disagree. If you're talking about boxing etc, then there are actually
two types for each value type: there's the value type itself and the
reference type. An object has a type regardless of whether it's in a
variable somewhere or not.
[color=blue]
> That it coincides in .NET with structs vs classes as well as in Java with
> primitive types vs classes is something else, made for convenience.
>
> If we lift the concepts above the actual languages and platforms it could be
> something else. For example, if you define a class or a struct in C++, they
> are by themselves neither value nor reference types.[/color]
If it's a .NET type then it is deinitely one or the other though. I
believe this is one of those topics where it doesn't make sense to talk
details without reference to the particular platform involved.
--
Jon Skeet - <skeet@pobox.co m>
If replying to the group, please do not mail me too
Comment