[Top][All Lists]

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

Re: Broken dream of mine :(

From: Bas Wijnen
Subject: Re: Broken dream of mine :(
Date: Tue, 15 Sep 2009 18:26:10 +0200
User-agent: Mutt/1.5.18 (2008-05-17)


On Mon, Sep 14, 2009 at 03:30:08PM +0530, arnuld uttre wrote:
> I wanted to work on a language which is not designed for PDP-11 but
> for modern 32bit hardware.

It is a common mistake to think that "this is old, and therefore good".
However, you seem to make the other mistake that "this is new, and
therefore better".  Both are not true.  Old things may be good, and new
things may be better.

> Hardware has come a long way from PDP-11 to AMD Phenom Gen II but the
> software is not.

In fact, it has evolved, which is a pity.  The 80x86 is one of the worst
architectures I know, definitely much worse than for example arm or
mips.  However, many people have done a lot of work to optimize it, and
that resulted in something which isn't as bad as it started with, and
they did indeed manage to outperform better designs by brute force (at
the cost of excessive power usage, but that isn't a problem everywhere).
Still I believe it would have been much nicer if the starting point
would have been a good architecture.

Anyway, it historically makes sense that a language evolves with
hardware.  And C, even if it still has the same name, has evolved a bit
as well.  The real evolution is of course in the step to C++, where it
really becomes a different language (if you want to use it that way).

> I think a project as complex as Hurd needs to use a language that is
> specifically designed for that project, that can work according to the
> basic design of the OS not the other way around.

I disagree that a complex project must have its own language.  It must
have a language which is suitable for the problem that is to be solved,
but that doesn't mean the language needs to be designed.  A language is
a way of thinking.  It is likely that there already exists a language
which fits the way you think about your projects.  It most likely is the
language you most use.  It may be a good idea to try a different one.
But to design a new language in order to better solve a problem, IMO
that can only succesfully work for a genious.  For normal people,
designing a language is a task in itself, and it takes many programs,
among which several large ones, to complete that task.  Only then is it
"the perfect language" for some tasks.  I'm sure you agree the Hurd
doesn't need another time consuming task at the moment. ;-)

>  How many of you think that using C is still a good idea ?
> Do you think using C fits that criteria for Hurd ?

I have written a toy kernel for x86 some time ago, in the spirit of
discussions I had on this list with Shapiro and others.  That kernel was
written in C.  It worked, and I am still quite happy about it.  If
others would have joined, it might have become a serious kernel, maybe
even the basis for the Hurd.

However, nobody did, and I moved on as well.  Recently, I started
writing a new kernel[0], for a mips-based mini-pc, mostly with the same
ideas, but now in C++[1].  Of course I'm not using any libraries, so no
new, virtual member functions, exceptions, or any other fancy things.
But I do sort my code in classes with normal member functions and
namespaces, and I do use default function arguments and a few templates
(but not the STL, because it uses new).

This is so much better.  In C, I'm happy when things are possible, and I
try to make them work with not too much strange constructs for the
application programmer (preprocessor macros can be used very creatively,
I'm sure you know), often at the cost of strange and unreadable
constructs in header files, leading to uncomprehensible warnings (this
also happens in some places in the Linux kernel btw).  In C++ things can
almost everywhere be done with native methods, which leads to much
cleaner (but not slower) code.  This is not only true in the header
files, but also in the kernel source itself, and in the "applications"
I've written (which are mostly device drivers).

Of course Richard Stallman is a known hater of C++.  He has a point that
everybody knows C, so using that makes the code readable for everyone.
However, our main interest is not that everyone can read our code.
While that counts for bonus points, the main point is that we can read
(and write) the code ourselves, and that we can efficiently create
things in it.  IMO his love for C is unreasonable.  C may still be
useful in some places, but not in big projects.  With my kernels, I
personally found out that even when you think that C is a suitable
language for doing something, it may still be much easier in C++ (and
probably in another higher-level language as well, but I do share his
concerns about Java and C#, so I would never recommend those).

For me the Hurd is currently sleeping.  When it wakes up, I'll probably
contribute again, and I certainly wouldn't mind if it would be in C++.
At the moment, I'm working on kernel stuff anyway (I just like that).
And of course I do it completely my way when I don't need to cooperate
with others. :-)

I have a question for you as well: why are you asking?  Are you just
amazed that people still want to use ancient tools for modern projects?
Or are you considering to contibute to it yourself?[2]  Or do you have
some other reason?


[0] http://projects.qi-hardware.com/index.php/p/iris/
[1] Actually, I'm using my own preprocessor to make certain Python
    constructs work.  But all the thinking is in C++.
[2] If you want to contibute to a kernel in a higher-level language, you
    are welcome to help me with Iris[0]. ;-)  I suppose you're not, as
    you wrote that you're not a C++ person, but I couldn't resist to
    suggest it. ;-)

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]