value type paradox

Discussion in 'Java' started by bobby, Oct 22, 2009.

  1. bobby

    bobby Guest

    Hello group,

    what is a value type in C++ or Java or C#? Is it a class or an object?
    I can see one can call a method(For instance ToString()) on an Int16
    and so on;So is it an object?At the same time we use Int16 to
    instantiate a variable Int16 a =new Int16();So is it a class?

    can clarify this for me?Class or Object

    Thanks
    B.
    bobby, Oct 22, 2009
    #1
    1. Advertising

  2. bobby

    markspace Guest

    bobby wrote:
    > Hello group,
    >
    > what is a value type in C++ or Java or C#? Is it a class or an object?
    > I can see one can call a method(For instance ToString()) on an Int16
    > and so on;So is it an object?At the same time we use Int16 to
    > instantiate a variable Int16 a =new Int16();So is it a class?
    >
    > can clarify this for me?Class or Object



    Google is your friend:

    http://en.wikipedia.org/wiki/Value_type

    "In object-oriented programming, a value type is a data type that can
    exist outside dynamic memory allocation."


    I'd say in Java value types are primitives, and that's it. I'm not sure
    of the definition of "value type" on Wikipedia, though. It's got a note
    about further discussion being needed. It might be a term from another
    programming language (C#?) leaking into the general programming vernacular.
    markspace, Oct 22, 2009
    #2
    1. Advertising

  3. bobby

    bobby Guest

    But All types are derived from System.ValueType which, in turn,
    inherits from class Object.Some seems that it is an object of class.

    On Oct 22, 5:58 pm, markspace <> wrote:
    > bobby wrote:
    > > Hello group,

    >
    > > what is a value type in C++ or Java or C#? Is it a class or an object?
    > > I can see one can call a method(For instance ToString()) on an Int16
    > > and so on;So is it an object?At the same time we use Int16 to
    > > instantiate a variable Int16 a =new Int16();So is it a class?

    >
    > > can clarify this for me?Class or Object

    >
    > Google is your friend:
    >
    > http://en.wikipedia.org/wiki/Value_type
    >
    > "In object-oriented programming, a value type is a data type that can
    > exist outside dynamic memory allocation."
    >
    > I'd say in Java value types are primitives, and that's it. I'm not sure
    > of the definition of "value type" on Wikipedia, though. It's got a note
    > about further discussion being needed. It might be a term from another
    > programming language (C#?) leaking into the general programming vernacular.
    bobby, Oct 22, 2009
    #3
  4. bobby

    Daniel Pitts Guest

    bobby wrote:
    > But All types are derived from System.ValueType which, in turn,
    > inherits from class Object.Some seems that it is an object of class.

    System.ValueType is not a Java class.
    Object.Some is not a Java class.

    If you consider a Value Type as an type with Value semantics (the object
    state is the identity of the object), then you're looking at immutable
    objects or primitives, or reference values themselves. At least, that's
    how it is in Java.

    In C++, you can define a class that has value semantics (deep copy,
    pass-by-value, rarely makes sense to have a pointer to the object,
    comparison is a primitive operation, etc...). I'm sure this is the case
    in other languages too.

    --
    Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
    Daniel Pitts, Oct 22, 2009
    #4
  5. bobby

    Stefan Ram Guest

    Daniel Pitts <> writes:
    >If you consider a Value Type as an type with Value semantics (the object
    >state is the identity of the object)


    I'd explain that this way:

    Let »v« be a function from the type T into a set S. (This is
    not a method nor a set in the sense of Java, but a function
    and set in the sense of mathematics, so there does not have
    to be a definition of v or S in Java code.)

    Let x and y be objects of the type T.

    We call v(x) the »v value of x«.

    Iff the result and behavior of any expression¹ with
    subexpressions of the value type depends only on the v value
    of these subexpressions, then T is a value type with regard
    to v.

    For example, x.equals( y ) (in Java code) iff v(x) is v(y)
    (in our set S outside of Java code).

    1) Except for some special cases, such as »x == y«.

    (This definition was just invented by me according to my
    personal interpretation of this notion.)
    Stefan Ram, Oct 22, 2009
    #5
  6. bobby

    Arne Vajhøj Guest

    Eric Sosman wrote:
    > bobby wrote:
    >> On Oct 22, 5:58 pm, markspace <> wrote:
    >>> bobby wrote:
    >>>> Hello group,
    >>>> what is a value type in C++ or Java or C#? [...]
    >>> Google is your friend:
    >>>
    >>> http://en.wikipedia.org/wiki/Value_type
    >>>
    >>> "In object-oriented programming, a value type is a data type that can
    >>> exist outside dynamic memory allocation."
    >>>
    >>> I'd say in Java value types are primitives, and that's it. I'm not sure
    >>> of the definition of "value type" on Wikipedia, though. It's got a note
    >>> about further discussion being needed. It might be a term from another
    >>> programming language (C#?) leaking into the general programming
    >>> vernacular.

    >>
    >> But All types are derived from System.ValueType which, in turn,
    >> inherits from class Object.Some seems that it is an object of class.

    >
    > No. Perhaps this is true in some of the other languages you ask
    > about, but it is not true of Java.


    He is talking about .NET !

    Arne
    Arne Vajhøj, Oct 23, 2009
    #6
  7. bobby

    markspace Guest

    bobby wrote:
    > But All types are derived from System.ValueType which, in turn,
    > inherits from class Object.Some seems that it is an object of class.



    I have to agree with the others: I have no idea what you are talking
    about vis-a-vis System.ValueType.

    As for Object.Some ... most English users put two spaces after the
    period that ends a sentence.
    markspace, Oct 23, 2009
    #7
  8. bobby

    Arne Vajhøj Guest

    markspace wrote:
    > bobby wrote:
    >> But All types are derived from System.ValueType which, in turn,
    >> inherits from class Object.Some seems that it is an object of class.

    >
    > I have to agree with the others: I have no idea what you are talking
    > about vis-a-vis System.ValueType.


    It is a .NET thingy:
    http://msdn.microsoft.com/en-us/library/system.valuetype.aspx

    Arne
    Arne Vajhøj, Oct 23, 2009
    #8
  9. bobby

    markspace Guest

    Arne Vajhøj wrote:
    > markspace wrote:
    >> bobby wrote:
    >>> But All types are derived from System.ValueType which, in turn,
    >>> inherits from class Object.Some seems that it is an object of class.

    >>
    >> I have to agree with the others: I have no idea what you are talking
    >> about vis-a-vis System.ValueType.

    >
    > It is a .NET thingy:
    > http://msdn.microsoft.com/en-us/library/system.valuetype.aspx



    I was sorta suspecting that, but in this news group I assume Java, if
    not advised otherwise.

    I don't know any C#, so I may of little use in this discussion.
    markspace, Oct 23, 2009
    #9
  10. bobby

    Lew Guest

    Lew, Oct 23, 2009
    #10
  11. Lew wrote:
    > Arne Vajhøj wrote:
    >>> It is a .NET thingy:
    >>> http://msdn.microsoft.com/en-us/library/system.valuetype.aspx

    >
    > markspace wrote:
    >> I was sorta suspecting that, but in this news group I assume Java, if
    >> not advised otherwise.

    >
    > As you have every right to do.


    I suspect that the OP posted to the wrong group.

    Arne
    Arne Vajhøj, Oct 23, 2009
    #11
  12. bobby

    Arne Vajhøj Guest

    bobby wrote:
    > what is a value type in C++ or Java or C#? Is it a class or an object?
    > I can see one can call a method(For instance ToString()) on an Int16
    > and so on;So is it an object?At the same time we use Int16 to
    > instantiate a variable Int16 a =new Int16();So is it a class?
    >
    > can clarify this for me?Class or Object


    Everything in your question seems to relate to .NET and C#.

    I suggest you try and post to:
    microsoft.public.dotnet.languages.csharp

    Arne
    Arne Vajhøj, Oct 23, 2009
    #12
  13. bobby

    markspace Guest

    Arne Vajhøj wrote:
    > bobby wrote:
    >> what is a value type in C++ or Java or C#? Is it a class or an object?
    >> I can see one can call a method(For instance ToString()) on an Int16
    >> and so on;So is it an object?At the same time we use Int16 to
    >> instantiate a variable Int16 a =new Int16();So is it a class?
    >>
    >> can clarify this for me?Class or Object

    >
    > Everything in your question seems to relate to .NET and C#.


    Except for the words C++ and Java.

    >
    > I suggest you try and post to:
    > microsoft.public.dotnet.languages.csharp


    Probably a good idea, actually.
    markspace, Oct 23, 2009
    #13
  14. bobby

    Eric Sosman Guest

    Arne Vajhøj wrote:
    > Eric Sosman wrote:
    >> bobby wrote:
    >>> [,,,]
    >>> But All types are derived from System.ValueType which, in turn,
    >>> inherits from class Object.Some seems that it is an object of class.

    >>
    >> No. Perhaps this is true in some of the other languages you ask
    >> about, but it is not true of Java.

    >
    > He is talking about .NET !


    Then he should talk about it in a Microsoft forum, not
    here. This group is dedicated to solely to Fortran.

    --
    Eric Sosman
    lid
    Eric Sosman, Oct 23, 2009
    #14
  15. bobby

    Lew Guest

    Eric Sosman wrote:
    > Then he should talk about it in a Microsoft forum, not
    > here. This group is dedicated to solely to Fortran.


    But I came here looking for an argument!

    --
    Lew
    Lew, Oct 23, 2009
    #15
  16. bobby

    Arne Vajhøj Guest

    Eric Sosman wrote:
    > Arne Vajhøj wrote:
    >> Eric Sosman wrote:
    >>> bobby wrote:
    >>>> [,,,]
    >>>> But All types are derived from System.ValueType which, in turn,
    >>>> inherits from class Object.Some seems that it is an object of class.
    >>>
    >>> No. Perhaps this is true in some of the other languages you ask
    >>> about, but it is not true of Java.

    >>
    >> He is talking about .NET !

    >
    > Then he should talk about it in a Microsoft forum, not
    > here. This group is dedicated to solely to Fortran.


    WRITE(*,*) 'FUNNY'
    END

    Arne
    Arne Vajhøj, Oct 23, 2009
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VVJHRU5ULi5QbGVhc2U=?=

    Is this a PARADOX?

    =?Utf-8?B?VVJHRU5ULi5QbGVhc2U=?=, Sep 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    365
    Greg Burns
    Sep 5, 2004
  2. Ricardo Magalhaes

    Connecting with paradox file..

    Ricardo Magalhaes, Apr 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    494
    Ricardo Magalhaes
    Apr 12, 2005
  3. Ricardo Magalhaes

    Viewing Paradox Data Without Correct Accentuation

    Ricardo Magalhaes, Apr 14, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    357
    Ricardo Magalhaes
    Apr 14, 2005
  4. KiwiBrian

    Streaming paradox

    KiwiBrian, Dec 4, 2005, in forum: HTML
    Replies:
    7
    Views:
    441
  5. KiwiBrian

    Dynamic resize of image paradox

    KiwiBrian, May 12, 2006, in forum: HTML
    Replies:
    4
    Views:
    567
    sunil
    May 14, 2006
Loading...

Share This Page