[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unidentified subject!



(disclaimer: I've only dabbled in Hurd internals so far)

On Wed, Jan 26, 2000 at 07:30:54AM -0500, Galup, Luis E (CRD) was heard to say:
> i am intrigued by the 'object-oriented' claim they are making in
> the web pages about the HURD. however, everywhere it says
> that it is being written in C, a non-OO language. what does this
> mean?

  Languages are irrelevant.  You could write an object-oriented program in
*assembly language* if you felt like it; if you need a proof of this,
disassemble the output of a C++ compiler and run it back through the
assembler :-)  Admittedly it would be much more painful and tedious than in,
say, Python..but it could be done.
  Writing object-oriented programs in C is much more doable, with a small amount
of extra effort.  For another example of this, see GTK+, an object-oriented
widget set implemented in C..and even the Unix file model has a slight
object-oriented 'feel' to it (everything's a file, right?)  Basically you have
to throw lots of extra function pointers around for everything, which is done
transparently by an object-oriented language.

  So that's a brief assertion that doing OO programming in C is possible.  Why
does the Hurd use it?  I don't know :)  Someone else who knows more will have to
give a real answer, but just for the heck of it, here are my three guesses:
  1) C is lower-level than C++ and you can control the output more closely.
    Given that (a) the Hurd doesn't /seem/ like the sort of thing where you need
    really tight output control (this stuff would be in gnumach..correct?) and
    (b) C++ is mostly a superset of C, this seems like an unlikely reason.
  2) Good free (or maybe even good non-free) C++ compilers weren't available
    when work on the Hurd commenced to start.
  3) The developers felt like it.

  And now one question of my own: how much stuff does Hurd's
'object-orientation' handle?  What I saw was mostly interface-implementation
stuff; for example, defining a filesystem interface and then having servers
implement it by filling in the functions.  Is inheritence also supported, as
in GTK+?  Or is it not really necessary for what the Hurd needs to do?
(probably I should just look at the source and work this out for myself, I
guess..)

  Daniel

-- 
  "People would panic?"
  "Very briefly, I'm afraid."

     -- The dangers of colliding with a star examined;
           Terry Pratchett, _The Light Fantasic_


Reply to: