[newbie]system programming ?

Richard greon@best.com
Thu, 06 Sep 2001 07:39:18 -0700


hooh pxw writes:

>ghc can be "alternative" C ? 
>Say that, linux device driver developing,
>or low-level/independent GUI programming.
>
  [list of extension to the Linux kernel]
>
>these project written in c, Is it can be replaced by
>GHC(*.lhs)? 

No.  None of the functional programming languages are competitive with
procedural languages in programming of traditional kernels.  This is
because such programming requires finer control over memory and cpu
cycles than GHC gives you and because a large part of such programming
is designing and using very efficient interfaces to other parts of the
operating system.  GHC code can interface with C code, but not as
efficiently or as flexibly as C or C++ code can interface with C code.

An example of where GHC does not give you enough control over memory and
cpu resources is that the code generated by GHC uses heap storage
managed by a garbage collector.  I doubt that the Linux
kernel has a garbage collector now or that adding one would be a good
idea.