What is an object?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas Stegen

    #16
    Re: What is an object?

    E. Robert Tisdale wrote:[color=blue]
    > Thomas Stegen wrote:
    >[color=green]
    >> there is no behaviour associated as such with C objects.[/color]
    >
    >
    > That's *not* true.
    > Behavior is *precisely* defined for *all* of the built-in types
    > and behavior for any User Defined Type (UDT) [struct]
    > is defined by the programmer.[/color]

    Nope, in C, the data is applied to operators. In the above sense
    operators (or messages) are applied to data.

    --
    Thomas.

    Comment

    • Keith Thompson

      #17
      Re: What is an object?

      "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > writes:[color=blue]
      > Thomas Stegen wrote:[color=green]
      > > Looking at "An object has state, behavior, and identity;
      > > the structure and behavior of similar objects
      > > are defined in their common class;
      > > the terms instance and object are interchangeable " we can
      > > see that C object does not fit in this set,[/color]
      >[color=green]
      > > there is no behaviour associated as such with C objects.[/color]
      >
      > That's *not* true.
      > Behavior is *precisely* defined for *all* of the built-in types
      > and behavior for any User Defined Type (UDT) [struct]
      > is defined by the programmer.[/color]

      Types have behavior; that doesn't imply that objects have behavior.

      An object (as the term is defined in the C standard, and as I believe
      Thomas Stegen was using the term) needn't have a type.

      For example:

      void *ptr = malloc(42);

      The region of data storage to which ptr points (assuming malloc()
      returned a non-null result) is an object, but it has no inherent type.

      --
      Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
      San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
      We must do something. This is something. Therefore, we must do this.

      Comment

      • Keith Thompson

        #18
        Re: What is an object?

        "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > writes:
        [...][color=blue]
        > I believe that functions are objects in both Python and Java.
        > What, exactly, in the [C standard] definition of object,
        > disqualifies functions as objects?[/color]

        A function is not a "region of data storage in the execution
        environment, the contents of which can represent values".

        --
        Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
        San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
        We must do something. This is something. Therefore, we must do this.

        Comment

        • Niklas Matthies

          #19
          Re: What is an object?

          On 2004-08-17 21:45, E. Robert Tisdale wrote:
          :[color=blue]
          > I believe that functions are objects in both Python and Java.[/color]

          In Python perhaps, but not in Java.

          -- Niklas Matthies

          Comment

          • CBFalconer

            #20
            Re: What is an object?

            "E. Robert Tisdale" wrote:[color=blue]
            >[/color]
            .... snip ...[color=blue]
            >
            > I believe that functions are objects in both Python and Java.
            > What, exactly, in the [C standard] definition of object,
            > disqualifies functions as objects?[/color]

            The wording.

            --
            "The most amazing achievement of the computer software industry
            is its continuing cancellation of the steady and staggering
            gains made by the computer hardware industry..." - Petroski


            Comment

            • CBFalconer

              #21
              Re: What is an object?

              "E. Robert Tisdale" wrote:[color=blue]
              > Thomas Stegen wrote:
              >[color=green]
              >> Looking at "An object has state, behavior, and identity;
              >> the structure and behavior of similar objects
              >> are defined in their common class;
              >> the terms instance and object are interchangeable " we can
              >> see that C object does not fit in this set,[/color]
              >[color=green]
              >> there is no behaviour associated as such with C objects.[/color]
              >
              > That's *not* true.
              > Behavior is *precisely* defined for *all* of the built-in types
              > and behavior for any User Defined Type (UDT) [struct]
              > is defined by the programmer.[/color]

              Google for "reading for comprehension"

              --
              "The most amazing achievement of the computer software industry
              is its continuing cancellation of the steady and staggering
              gains made by the computer hardware industry..." - Petroski


              Comment

              • E. Robert Tisdale

                #22
                Re: What is an object?

                Malcolm wrote:
                [color=blue]
                > E. Robert Tisdale wrote:
                >[color=green]
                >>What is an object?
                >>[/color]
                >
                > In C, an entity with contiguous storage that can be represented by a single
                > identifier, or an array of such entities.
                > In general computing terms, data items with a close relationship to each
                > other that it makes sense to regard as being part of the same entity.
                >[color=green]
                >>Where did this term come from?
                >>[/color]
                >
                > Not sure when "object" was first used in computing terms.
                > The important date is the use of "object-oriented".[/color]

                The term "object-oriented" was coined by Alan Kay (in 1967?)


                Comment

                • E. Robert Tisdale

                  #23
                  Re: What is a type?

                  Niklas Matthies wrote:[color=blue]
                  > On 2004-08-17 19:55, Eric Sosman wrote:
                  >[color=green]
                  >>Keith Thompson wrote:
                  >>[color=darkred]
                  >>>An "object" in the sense defined in the C standard does have
                  >>>contiguous storage (and doesn't necessarily have a type). [...][/color]
                  >>
                  >> The word "necessaril y" can be deleted. A C object is
                  >>simply and only a region of data storage, and has no type.
                  >>The expressions that inspect and manipulate the object have
                  >>types, and their types govern the interpretation of the bits
                  >>that reside in the object, but the object itself is typeless.[/color]
                  >
                  >
                  > That's not quite correct. Objects do have a so-called effective type.
                  > See C99 6.5p6-7:
                  >
                  > The /effective type/ of an object for an access to its stored value
                  > is the declared type of the object, if any.72) If a value is stored
                  > into an object having no declared type through an lvalue having a
                  > type that is not a character type, then the type of the lvalue
                  > becomes the effective type of the object for that access and for
                  > subsequent accesses that do not modify the stored value. If a value
                  > is copied into an object having no declared type using memcpy or
                  > memmove, or is copied as an array of character type, then the
                  > effective type of the modified object for that access and for
                  > subsequent accesses that do not modify the value is the effective
                  > type of the object from which the value is copied, if it has one.
                  > For all other accesses to an object having no declared type, the
                  > effective type of the object is simply the type of the lvalue used
                  > for the access.
                  >
                  > Footnote: 72) Allocated objects have no declared type.
                  >
                  > An object shall have its stored value accessed only by an lvalue
                  > expression that has one of the following types:73)
                  > - a type compatible with the effective type of the object,
                  > - a qualified version of a type compatible with the effective type
                  > of the object,
                  > - a type that is the signed or unsigned type corresponding to the
                  > effective type of the object,
                  > - a type that is the signed or unsigned type corresponding to a
                  > qualified version of the effective type of the object,
                  > - an aggregate or union type that includes one of the
                  > aforementioned types among its members (including, recursively,
                  > a member of a subaggregate or contained union), or
                  > - a character type.
                  >
                  > 73) The intent of this list is to specify those circumstances in
                  > which an object may or may not be aliased.[/color]

                  What do you mean by type?

                  How is a C type different from an Abstract Data Type (ADT):

                  1.) the set of values that an object can have
                  together with
                  2.) all of the methods that can be applied
                  to an object of that type.

                  Does a C type depend upon its representation?
                  Is data abstraction possible in C?

                  Comment

                  • E. Robert Tisdale

                    #24
                    Re: What is an object?

                    Michael B Allen wrote:
                    [color=blue]
                    > E. Robert Tisdale wrote:
                    >[color=green]
                    >>What is an object?[/color]
                    >
                    > It's a tangible thing.
                    >[color=green]
                    >>Where did this term come from?[/color]
                    >
                    > Middle English, from Medieval Latin /objectum/.
                    >[color=green]
                    >>Does it have any relation
                    >>to the objects in "object oriented programming"?[/color]
                    >
                    > Not necessarily. In programing, an "object" can refer to virtually anything
                    > (although probably limited to things that occupy memory).
                    > So a struct or even an primative type like an int.
                    > With this definition objects in "object oriented programming"
                    > are no different from C, OOP just associates the functions
                    > that operate on that object with the object.
                    > So you do letter.Write(st ream) vs. letter_write(le tter, stream).
                    > Of course OOP adds a lot of other fancy stuff that can be useful.[/color]

                    I'm pretty sure that C objects are *not* tangible things
                    and I don't think that
                    the definition of object used in the C standards documents
                    appears anywhere in Medieval Latin.
                    The C programming language also associates functions (and operators)
                    with objects of built-in types and allows programmers
                    to define functions for any User Defined Type (UDT) [struct].

                    Comment

                    • E. Robert Tisdale

                      #25
                      Re: What is an object?

                      Keith Thompson wrote:[color=blue]
                      > "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > writes:
                      >[color=green]
                      >>Thomas Stegen wrote:
                      >>[color=darkred]
                      >>>Looking at "An object has state, behavior, and identity;
                      >>>the structure and behavior of similar objects
                      >>>are defined in their common class;
                      >>>the terms instance and object are interchangeable " we can
                      >>>see that C object does not fit in this set,[/color]
                      >>[color=darkred]
                      >>>there is no behaviour associated as such with C objects.[/color]
                      >>
                      >>That's *not* true.
                      >>Behavior is *precisely* defined for *all* of the built-in types
                      >>and behavior for any User Defined Type (UDT) [struct]
                      >>is defined by the programmer.[/color]
                      >
                      >
                      > Types have behavior; that doesn't imply that objects have behavior.
                      >
                      > An object (as the term is defined in the C standard, and as I believe
                      > Thomas Stegen was using the term) needn't have a type.
                      >
                      > For example:
                      >
                      > void *ptr = malloc(42);
                      >
                      > The region of data storage to which ptr points (assuming malloc()
                      > returned a non-null result) is an object, but it has no inherent type.[/color]

                      So void is not a type?

                      Comment

                      • E. Robert Tisdale

                        #26
                        Re: What is an object?

                        Thomas Stegen wrote:
                        [color=blue]
                        > E. Robert Tisdale wrote:
                        >[color=green]
                        >> Thomas Stegen wrote:
                        >>[color=darkred]
                        >>> there is no behaviour associated as such with C objects.[/color]
                        >>
                        >> That's *not* true.
                        >> Behavior is *precisely* defined for *all* of the built-in types
                        >> and behavior for any User Defined Type (UDT) [struct]
                        >> is defined by the programmer.[/color]
                        >
                        > Nope, in C, the data is applied to operators.
                        > In the above sense, operators (or messages) are applied to data.[/color]

                        Could you please explain the difference?

                        Comment

                        • E. Robert Tisdale

                          #27
                          Re: What is an object?

                          Keith Thompson wrote:
                          [color=blue]
                          > E. Robert Tisdale writes:
                          > [...]
                          >[color=green]
                          >>I believe that functions are objects in both Python and Java.
                          >>What, exactly, in the [C standard] definition of object,
                          >>disqualifie s functions as objects?[/color]
                          >
                          > A function is not a "region of data storage in the execution
                          > environment, the contents of which can represent values".[/color]

                          Why?

                          Comment

                          • Martin Ambuhl

                            #28
                            Re: What is an object?

                            CBFalconer wrote:
                            [color=blue]
                            > "E. Robert Tisdale" wrote:[/color]
                            [color=blue][color=green]
                            >>That's *not* true.
                            >>Behavior is *precisely* defined for *all* of the built-in types
                            >>and behavior for any User Defined Type (UDT) [struct]
                            >>is defined by the programmer.[/color]
                            >
                            > Google for "reading for comprehension"[/color]

                            Trollsdale is trying to convince us of his stupidity. I admit that he
                            has won me over: he really *is* that stupid.


                            Comment

                            • Keith Thompson

                              #29
                              Re: What is an object?

                              "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > writes:[color=blue]
                              > Keith Thompson wrote:[/color]
                              [...][color=blue][color=green]
                              > > Types have behavior; that doesn't imply that objects have behavior.
                              > > An object (as the term is defined in the C standard, and as I believe
                              > > Thomas Stegen was using the term) needn't have a type.
                              > > For example:
                              > > void *ptr = malloc(42);
                              > > The region of data storage to which ptr points (assuming malloc()
                              > > returned a non-null result) is an object, but it has no inherent type.[/color]
                              >
                              > So void is not a type?[/color]

                              void is a type. More specifically, void is an incomplete type.

                              void is not an object type. The object to which ptr points is not an
                              object of type void, because there is no such thing.

                              --
                              Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                              San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
                              We must do something. This is something. Therefore, we must do this.

                              Comment

                              • Keith Thompson

                                #30
                                Re: What is an object?

                                Keith Thompson <kst-u@mib.org> writes:[color=blue]
                                > "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > writes:[color=green]
                                > > Keith Thompson wrote:[/color]
                                > [...][color=green][color=darkred]
                                > > > Types have behavior; that doesn't imply that objects have behavior.
                                > > > An object (as the term is defined in the C standard, and as I believe
                                > > > Thomas Stegen was using the term) needn't have a type.
                                > > > For example:
                                > > > void *ptr = malloc(42);
                                > > > The region of data storage to which ptr points (assuming malloc()
                                > > > returned a non-null result) is an object, but it has no inherent type.[/color]
                                > >
                                > > So void is not a type?[/color]
                                >
                                > void is a type. More specifically, void is an incomplete type.
                                >
                                > void is not an object type. The object to which ptr points is not an
                                > object of type void, because there is no such thing.[/color]

                                I see I was slightly ambiguous. I meant that there is no such thing
                                as an object of type void. (It could be interpreted to mean that
                                there is no such thing as the object to which ptr points; in fact,
                                there is such an object.)

                                --
                                Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                                San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
                                We must do something. This is something. Therefore, we must do this.

                                Comment

                                Working...