bearophile wrote:
Walter:

Based on what?

It's just a lump of opinions of mine, I have not written a microkernel yet
:-) But I am reading a lot, I am learning and I will be able to write this
kind of code too.

Some people have tried to write a kernel with Python. D2 is a nice language
to use, it allows some low level control, inline asm, and it compilation
model comes from C with things added. So I am sure it's possible to write a
good enough kernel with D2. So it's a matter of how much the language is fit
for this purpose, it's not a binary thing. Is D2 the best conceivable
language to write a kernel? I don't think so (but I am often wrong).

It's not perfect, but it is better than any other existing language.


For a kernel writer D2 doesn't offer a lot of control on low level matters,
like how the compiler compiles and optimizes code (see the thread about
"guaranteed optimizations".

I'm afraid that's baloney, as I pointed out in the other thread.


This is a case where you don't want to "Let the
compiler implementors do their job" because you lose low-level control on the
code produced and this introduces bugs). This was one of the main complaints
of Linus against C++ for Linux kernel development.

I think that is a serious misinterpretation of the complaint. The complaint was actually that the high level abstractions that one can choose to use in C++ can be impenetrable in what they do. In D, if you want low level control, write low level code. It's that simple.


D2 type system is refined and much more powerful than the C one. And people
have written many kernels with C (C plus with few nonstandard extensions).
But if you want to write a modern kernel you may want a type system more
powerful than the C and D ones, that give stronger static guarantees. Linus
has written a tool to strengthen the C type system: http://en.wikipedia.org/wiki/Sparse

Yes, I know about Sparse. You can do the same thing in D without needing annotations.

In another thread I have written
something about typed assembly, useful to make less wild parts written in
assembly: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=125815 In some situations linear types too help: http://en.wikipedia.org/wiki/Linear_types

Typed assembler is a waste of effort in a language like D, as you only need a few drops of assembler here and there.

The Spec# language and the
experimental Verve kernel we have discussed a bit in past show possible
directions for future kernels, they require a pretty strong static analysis.

Those languages are failures at what they propose to do; they need years and perhaps decades to fulfill that.

The Sparse tool shows that some of those type system feature may be added
later to D with an external tool.

Like I said, you can already do that with D.

But Verve shows that sometimes you need something more built-in.

I don't buy that.

Reply via email to