D for kernel development [Was: Re: Advocacy]

bearophile bearophileHUGS at lycos.com
Sat Jan 1 23:31:18 PST 2011


Caligo:

> I agree with you on this.  For example, Linus Torvald hates C++ and probably for good reasons.  Imagine if Linus tries D and thinks it's a good language and begins to use it in kernel development.  I don't think I need to describe what would happen to D then.  Sadly, GDC is not in a good state right now.

Years ago he used to dislike C++ for kernel development, but I think later he has softened his position (despite no C++ is allowed in Linux kernel still).

Is D2 fit for kernel development? D is advertised as a system language, so in theory the answer may be positive. In practice, as for C++, a kernel developer may dislike D2 too for this kind of work. Ada has being used to write to-the-metal code, so the big language size is not the main problem.

The D GC may be a problem. On the other hand even a kernel often needs some kind of garbage collector (maybe a reference counting one. It probably needs to be deterministic). It may be useful a D compiler switch that turns all D code implicit and invisible usages of GC in syntax errors.

Some tools exist to debug or avoid memory-related errors in Linux:
http://www.yolinux.com/TUTORIALS/LinuxTutorialSoftwareDevelopment.html#MEMORYTOOLS
Stack too:
http://www.usenix.org/publications/library/proceedings/sec98/full_papers/cowan/cowan_html/node14.html

Linus has felt that C type system lacks some necessary things, so he has created a tool:
http://en.wikipedia.org/wiki/Sparse
I think that D type system must be able to do something similar (or better) if D wants to be fit for Linux development. The introduction of linear types in D may be another help for this.

Bye,
bearophile


More information about the Digitalmars-d mailing list