When will C have an object model?

Discussion in 'C Programming' started by Tech07, Sep 6, 2009.

  1. Tech07

    Tech07 Guest

    When will C have an object model?
     
    Tech07, Sep 6, 2009
    #1
    1. Advertising

  2. Tech07 wrote:
    > When will C have an object model?
    >
    >

    Please explain your definition of "object model"
    and how you think it will pertain to the
    C language.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.comeaucomputing.com/learn/faq/
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    http://www.sgi.com/tech/stl -- Standard Template Library
     
    Thomas Matthews, Sep 6, 2009
    #2
    1. Advertising

  3. Tech07

    Kaz Kylheku Guest

    On 2009-09-06, Tech07 <> wrote:
    > When will C have an object model?


    C isn't an extensible programming language. So adding an object system to C
    means that a new language is created (possibly one which has significant
    backward compatibility).

    This has already happened, quite long ago, and the results were given names
    like C++ and Objective C.
     
    Kaz Kylheku, Sep 6, 2009
    #3
  4. Tech07

    ld Guest

    On 6 sep, 06:40, Kaz Kylheku <> wrote:
    > On 2009-09-06, Tech07 <> wrote:
    >
    > > When will C have an object model?

    >
    > C isn't an extensible programming language.


    You could be interested by

    http://cos.cvs.sourceforge.net/viewvc/*checkout*/cos/doc/cos-draft-dls09.pdf

    to see how C itself is extensible and can do better than Objective-C.
    The C Object System is a C library which adds a rather complete object
    model to C (like CLOS to Common Lisp) and allows to build component
    (reusable generic object) that you can't built in C++ or Objective-C.

    One great thing with C is that it _hasn't_ an object model and
    therefore you can have your own. C is just missing two _syntactic_
    extension to emulate subtyping and overloading (backward compatible)
    and be qualified as an OO language.

    cheers,

    ld.
     
    ld, Sep 6, 2009
    #4
  5. Tech07

    Guest

    On Sat, 5 Sep 2009 21:59:45 -0500 Tech07 <> wrote:

    | When will C have an object model?

    It doesn't need one. Applications may need one, but languages don't.
    If you application needs one, choose a language that has one.

    --
    -----------------------------------------------------------------------------
    | Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
    | (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
    -----------------------------------------------------------------------------
     
    , Sep 6, 2009
    #5
  6. wrote:

    > On Sat, 5 Sep 2009 21:59:45 -0500 Tech07 <> wrote:
    >
    > | When will C have an object model?
    >
    > It doesn't need one. Applications may need one, but languages don't.
    > If you application needs one, choose a language that has one.


    And even then you can choose any language you like. You'll just have a
    little more work to do, implementing all the object system's backend stuff.

    Or use a ready to use object system. For C there is GObject. (Please no
    debates, GObject works and does it's job very well. In my experience GNOME
    is a lot more stable than KDE, and I'm saying this as a mainly-KDE user).


    Wolfgang
     
    Wolfgang Draxinger, Sep 6, 2009
    #6
  7. Tech07

    Bart Guest

    On Sep 6, 3:59 am, "Tech07" <> wrote:
    > When will C have an object model?


    Is this zero-terminated, or counted objects?

    --
    Bartc
     
    Bart, Sep 6, 2009
    #7
  8. Tech07

    Eric Sosman Guest

    Tech07 wrote:
    > When will C have an object model?


    When the National Hockey League schedules games in Hell.

    --
    Eric Sosman
    lid
     
    Eric Sosman, Sep 6, 2009
    #8
  9. In article <>,
    Malcolm McLean <> wrote:
    ....
    >Opinion is moving against object-oriented programming.


    Is it? I want to make it clear that I have no opinion on the subject,
    nor any stake in the outcome. I am just curious.

    But I will say this: The statement above looks like a political
    statement - like you generally see in the political/religious (Yes, at
    least in America, they are one in the same) groups. I.e., a "He said,
    she said" situation. For example, you often see this (in fact, this and
    variations of it are about all you do see in the political/religious
    groups):

    A: The Republican party is dead (marginalized, of no consequence).
    Note that its standards bearer these days is Sarah Palin (snicker, snicker)

    B: (No it's not) Surveys show that Americans are becoming more
    conservative (pro-life, etc, etc)

    So, what makes you think it (programming) is moving against OO?
     
    Kenny McCormack, Sep 6, 2009
    #9
  10. In article <>,
    Malcolm McLean <> wrote:
    ....
    >Stuff I've read. You used to read plenty of articles attacking C++, but not
    >object-oritented programming itself. Now I've notice far more material
    >attacking the very concept of object oriented programming.
    >
    >Dijkstra said "Object-oriented programming is an exceptionally bad idea
    >which could only have originated in California"
    >
    >The Wikipedia entry on "object-oriented programming" has a list of critics.
    >
    >I'd admit this isn't a very scientific survey, more an impression about they
    >way the wind is blowing.


    OK. What do you think is going to be "the next big thing"?

    BTW, the way these things go is that by the time business/industry has
    firmly adopted something, that's the clue that it is time for the
    academics and other smart people to disparage it and move on to "the
    next big thing." I.e., down in the trenches (business and industry)
    they seem to like OO just fine.
     
    Kenny McCormack, Sep 6, 2009
    #10
  11. In article <>,
    Malcolm McLean <> wrote:

    >Dijkstra said "Object-oriented programming is an exceptionally bad idea
    >which could only have originated in California"


    If Dijkstra said it that's hardly evidence of opinion turning that
    way, since he's been dead for years. And of course Dijkstra was
    hardly a mirror of general opinion...

    -- Richard
    --
    Please remember to mention me / in tapes you leave behind.
     
    Richard Tobin, Sep 6, 2009
    #11
  12. In article
    <>,
    ld <> wrote:

    > On 6 sep, 06:40, Kaz Kylheku <> wrote:
    > > On 2009-09-06, Tech07 <> wrote:
    > >
    > > > When will C have an object model?

    > >
    > > C isn't an extensible programming language.

    >
    > You could be interested by
    >
    > http://cos.cvs.sourceforge.net/viewvc/*checkout*/cos/doc/cos-draft-dls09.pdf
    >
    > to see how C itself is extensible and can do better than Objective-C.
    > The C Object System is a C library which adds a rather complete object
    > model to C (like CLOS to Common Lisp) and allows to build component
    > (reusable generic object) that you can't built in C++ or Objective-C.
    >


    I may be wrong about this, but I was always under the impression that
    C++ and Objective-C were super sets of C. If that's true, how can it be
    said that something can be done in C, but not C++ or Objective-C?

    Or in a strict sense, would it be said that C++ and Objective-C
    compilers are able to compile C code, but when doing so, they are not
    actually C++ or Objective-C compilers at that moment in time.
     
    Mark Storkamp, Sep 7, 2009
    #12
  13. Mark Storkamp <> writes:
    > In article
    > <>,
    > ld <> wrote:
    >> On 6 sep, 06:40, Kaz Kylheku <> wrote:
    >> > On 2009-09-06, Tech07 <> wrote:
    >> >
    >> > > When will C have an object model?
    >> >
    >> > C isn't an extensible programming language.

    >>
    >> You could be interested by
    >>
    >> http://cos.cvs.sourceforge.net/viewvc/*checkout*/cos/doc/cos-draft-dls09.pdf
    >>
    >> to see how C itself is extensible and can do better than Objective-C.
    >> The C Object System is a C library which adds a rather complete object
    >> model to C (like CLOS to Common Lisp) and allows to build component
    >> (reusable generic object) that you can't built in C++ or Objective-C.

    >
    > I may be wrong about this, but I was always under the impression that
    > C++ and Objective-C were super sets of C. If that's true, how can it be
    > said that something can be done in C, but not C++ or Objective-C?


    C++ is very nearly a superset of C. There are valid C programs that
    are not valid C++ programs, and there are even a few valid C programs
    that are valid C++ programs with different semantics. But in general,
    for a given valid C program, it's not difficult to convert it into
    a valid C program with the same semantics that's also a valid C++
    program with the same semantics.

    Objective-C is said to be a strict superset of C.

    I suspect what ld was saying is that the C Object System can be used
    to do things that can't be done using the object-oriented features of
    C++ or Objective-C. I can't comment on the accuracy of that claim.

    Presumably the COS library could be compiled as C++ or Objective-C,
    perhaps with some tweaks -- but that would be a rather odd thing to
    do.

    > Or in a strict sense, would it be said that C++ and Objective-C
    > compilers are able to compile C code, but when doing so, they are not
    > actually C++ or Objective-C compilers at that moment in time.


    No, they're still C++ or Objective-C compilers, and the programs
    they're compiling are still C++ or Objective-C programs (that also
    happen to be C programs).

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Sep 7, 2009
    #13
  14. Tech07

    ld Guest

    On 7 sep, 09:52, Keith Thompson <> wrote:
    > Mark Storkamp <> writes:
    > > In article
    > > <>,
    > >  ld <> wrote:
    > >> On 6 sep, 06:40, Kaz Kylheku <> wrote:
    > >> > On 2009-09-06, Tech07 <> wrote:

    >
    > >> > > When will C have an object model?

    >
    > >> > C isn't an extensible programming language.

    >
    > >> You could be interested by

    >
    > >>http://cos.cvs.sourceforge.net/viewvc/*checkout*/cos/doc/cos-draft-dl....

    >
    > >> to see how C itself is extensible and can do better than Objective-C.
    > >> The C Object System is a C library which adds a rather complete object
    > >> model to C (like CLOS to Common Lisp) and allows to build component
    > >> (reusable generic object) that you can't built in C++ or Objective-C.

    >
    > > I may be wrong about this, but I was always under the impression that
    > > C++ and Objective-C were super sets of C. If that's true, how can it be
    > > said that something can be done in C, but not C++ or Objective-C?

    >
    > C++ is very nearly a superset of C.  There are valid C programs that
    > are not valid C++ programs, and there are even a few valid C programs
    > that are valid C++ programs with different semantics.  But in general,
    > for a given valid C program, it's not difficult to convert it into
    > a valid C program with the same semantics that's also a valid C++
    > program with the same semantics.


    This is right. In principle, COS could be compiled by a C++ compiler
    which support variadic macros. The underlying code is C89 and I do not
    use C++ keyword.

    > Objective-C is said to be a strict superset of C.


    Yes, but since COS provide a super-set of Objective-C features, I
    choose to use 'self' (and self1, self2, ...) to reference message
    receivers (objects) inside their methods. Therefore, I am compatible
    with the C++ 'this' but not with the Objective-C 'self'. This could be
    changed in a 1/2 day but I don't see any reason to combine COS and
    Objective-C while I may try one day to combine C++ and COS. Now the
    real problem is why should I combine different object models together?
    What I am interested in C++, it's not its runtime object model, but
    things related to subtyping, overloading and templates (static
    features).

    > I suspect what ld was saying is that the C Object System can be used
    > to do things that can't be done using the object-oriented features of
    > C++ or Objective-C.  I can't comment on the accuracy of that claim.


    Yes, this is what I wanted to mean.

    > Presumably the COS library could be compiled as C++ or Objective-C,
    > perhaps with some tweaks -- but that would be a rather odd thing to
    > do.


    Right.

    > > Or in a strict sense, would it be said that C++ and Objective-C
    > > compilers are able to compile C code, but when doing so, they are not
    > > actually C++ or Objective-C compilers at that moment in time.

    >
    > No, they're still C++ or Objective-C compilers, and the programs
    > they're compiling are still C++ or Objective-C programs (that also
    > happen to be C programs).


    Right.

    Cheers,

    Laurent.
     
    ld, Sep 7, 2009
    #14
  15. pete <> writes:
    > Keith Thompson wrote:
    >> Mark Storkamp <> writes:

    [...]
    >>> Or in a strict sense, would it be said that C++ and Objective-C
    >>> compilers are able to compile C code, but when doing so, they are
    >>> not actually C++ or Objective-C compilers at that moment in time.

    >>
    >> No, they're still C++ or Objective-C compilers, and the programs
    >> they're compiling are still C++ or Objective-C programs (that also
    >> happen to be C programs).

    >
    > I don't know about that.
    >
    > It is possible that what a program does,
    > can depend only upon whether the compiler considers
    > it to be a C program or a C++ program.


    That doesn't falsify my statement. Certainly the *behavior* of a
    program can depend (in certain corner cases) on which language it's
    cpomiled in. But a C++ compiler compiling a C program is still a C++
    compiler, even if the behavior of the program differs from the
    behavior if it were compiled by a C program.

    And before anyone jumps in, we've already acknowledged that not all
    legal C programs are legal C++ programs.

    There's probably a long argument to be had about whether a C and C++
    program with the same source code but different behavior are the same
    program. I don't plan to participate in such an argument.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Sep 7, 2009
    #15
  16. On Sun, 6 Sep 2009 14:26:26 UTC, "Malcolm McLean"
    <> wrote:

    > "Tech07" <> wrote in message news:
    > > When will C have an object model?
    > >

    > You can do object-oriented programming In C, but it is messy because there
    > is no syntactical support so things like inheritance have to be scratched up
    > from tables of function pointers.
    >
    > Every so often someone comes up with some extensions to C, and an object
    > model is a common thing to add. C++ is the best-known example. There will be
    > other attempts, but none so far has been accepted into the core language,
    > and probably never will be. Opinion is moving against object-oriented
    > programming.


    C++ is not really object oriented. On that I miss real classes, class
    factories instead of renamed structs.

    You likes to program object oriented? Really object oriented, not ony
    C with renamed structs (classes)?

    Then look for CORBA.


    --
    Tschau/Bye
    Herbert

    Visit http://www.ecomstation.de the home of german eComStation
    eComStation 1.2R Deutsch ist da!
     
    Herbert Rosenau, Sep 8, 2009
    #16
  17. On Sun, 6 Sep 2009 02:59:45 UTC, "Tech07" <> wrote:

    > When will C have an object model?
    >
    >

    Done already more than 15 years back.

    Google for CORBA.

    Truly object oriented - mor that C++ will ever be.

    --
    Tschau/Bye
    Herbert

    Visit http://www.ecomstation.de the home of german eComStation
    eComStation 1.2R Deutsch ist da!
     
    Herbert Rosenau, Sep 8, 2009
    #17
  18. Tech07

    Default User Guest

    Herbert Rosenau wrote:

    > On Sun, 6 Sep 2009 02:59:45 UTC, "Tech07" <> wrote:
    >
    > > When will C have an object model?
    > >
    > >

    > Done already more than 15 years back.
    >
    > Google for CORBA.
    >
    > Truly object oriented - mor that C++ will ever be.



    CORBA? How is that a C object model?




    Brian
     
    Default User, Sep 8, 2009
    #18
  19. Tech07

    Tech07 Guest

    "Wolfgang Draxinger" <> wrote in message
    news:h804rm$h9e$-online.net...
    > wrote:
    >
    >> On Sat, 5 Sep 2009 21:59:45 -0500 Tech07 <> wrote:
    >>
    >> | When will C have an object model?
    >>
    >> It doesn't need one. Applications may need one, but languages don't.
    >> If you application needs one, choose a language that has one.

    >
    > And even then you can choose any language you like. You'll just have a
    > little more work to do, implementing all the object system's backend
    > stuff.
    >
    > Or use a ready to use object system. For C there is GObject. (Please no
    > debates, GObject works and does it's job very well. In my experience GNOME
    > is a lot more stable than KDE, and I'm saying this as a mainly-KDE user).


    Seems to contradict the purpose of a language standard. (You said, "just
    write one instead of suggesting that the language standard should codify
    existing practice for the purpose of getting widespread reuseability".)
     
    Tech07, Sep 9, 2009
    #19
  20. Tech07

    Tech07 Guest

    "Kaz Kylheku" <> wrote in message
    news:...
    > On 2009-09-06, Tech07 <> wrote:
    >> When will C have an object model?

    >
    > C isn't an extensible programming language. So adding an object system to
    > C
    > means that a new language is created (possibly one which has significant
    > backward compatibility).
    >
    > This has already happened, quite long ago, and the results were given
    > names
    > like C++ and Objective C.


    C could one up them though given that the aforementioned are the tired old
    models.
     
    Tech07, Sep 9, 2009
    #20
    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?c2NvdHRybQ==?=

    is there an object oriented design model asp.net?

    =?Utf-8?B?c2NvdHRybQ==?=, Feb 24, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    485
    =?Utf-8?B?c2NvdHRybQ==?=
    Feb 27, 2004
  2. Tarllem
    Replies:
    2
    Views:
    330
    MasterGaurav
    Mar 3, 2005
  3. Support
    Replies:
    6
    Views:
    3,267
    Support
    Mar 18, 2005
  4. =?Utf-8?B?UGF1bA==?=

    General question about component object model COM

    =?Utf-8?B?UGF1bA==?=, Oct 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    347
    =?Utf-8?B?UGF1bA==?=
    Oct 12, 2005
  5. Replies:
    1
    Views:
    497
    Andreas Wollschlaeger
    Oct 6, 2006
Loading...

Share This Page