caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Rewriting UNIX in Caml and getting rid of the C disease
@ 2001-11-11  5:17 Berke Durak
  2001-11-11  6:11 ` Eric Newhuis
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Berke Durak @ 2001-11-11  5:17 UTC (permalink / raw)
  To: caml-list

Everyone on this list will agree that the C language is far from being
perfect. More specifically, if we consider its various derivatives
together (i.e. the C preprocessor and C++) they form the worst piece
of stinking, pathogen and toxic garbage in the realm of programming
languages.

On the other hand, we almost all use and respect UNIX and its
derivatives, which might seem to be a paradox, given that UNIX is
entirely based on C.  I'm here considering UNIX from the system
programmer's view, making abstraction of the way it's
implemented. Certainly, it could get much better, but, practically, it
is just fine.

Unfortunately, the C language acts as a mandatory layer over
UNIX. Generating an executable for a given brand of UNIX without going
thru the C library is tricky because it requires to know how the
system calls work. These are, first, not documented (because you're
supposed to go thru the C library), and, second, depend precisely on
#ifdef-infested C source code, and are subject to revision.

Therefore, in the interests of humanity, I hereby propose that :

                              ***

An appropriate sublanguage of Caml should be isolated, and a given,
well-accepted brand of UNIX should be reimplemented in that language.
Binary compatibility must be retained as far as possible. Basic system
utilities (including a shell) should also be translated (into full
Ocaml). Since the use of Caml will, a) divide the source code size by,
say, ten and b) automatically remove, say, 95% of all bugs and
security holes (since most are illnesses resulting from pointer
manipulation), success is guaranteed.

                              ***

Progress has to be made in operating systems. C blocks that progress.
C must be obliterated.

The use and existence of a Caml-based UNIX, with a (justified)
reputation of very good security and integrity, will invariably
attract a lot of hackers (in the good sense) to Caml. It will also
make existing Caml programmers a valuable resource.

The use of Caml might also facilitate the verification of some parts
of it using Coq, even if I don't know what part of an operating system
you could usefully verify by formal methods.

For marketing purposes, a bijective mapping between some sort of
subgrammar of C and the sublanguage of Caml could be provided.

For people worrying about speed, I'd just remind them that not so long
ago, C itself was considered pretty slow and inefficient a language
(maybe the compilers weren't as good), yet operating systems 
were written in C and used on computers a thousand times slower than
what we have today.

Finally, the task of translating UNIX from C to Caml, if certainly
not straightforward, is certainly feasible with a predictable amount
of work, and could even be made semi-automatically.
--
Berke
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [Caml-list] Rewriting UNIX in Caml and getting rid of the C disease
@ 2001-11-12 21:52 Arturo Borquez
  0 siblings, 0 replies; 13+ messages in thread
From: Arturo Borquez @ 2001-11-12 21:52 UTC (permalink / raw)
  To: berke; +Cc: caml-list

On Sat, 10 November 2001, Berke Durak wrote:

> 
> Everyone on this list will agree that the C language is far from being
> perfect. More specifically, if we consider its various derivatives
> together (i.e. the C preprocessor and C++) they form the worst piece
> of stinking, pathogen and toxic garbage in the realm of programming
> languages.
> 
> On the other hand, we almost all use and respect UNIX and its
> derivatives, which might seem to be a paradox, given that UNIX is
> entirely based on C.  I'm here considering UNIX from the system
> programmer's view, making abstraction of the way it's
> implemented. Certainly, it could get much better, but, practically, it
> is just fine.
> 

I agree with you that C/C++ are the most pathological
and toxic programming languages ever made, but at UNIX
OS kernel level they do quite well (because the huge
amount of manpower invested in debugging by miriads of 
programmers and testers thru last 10 years). and are
fairly stable and reliable. I am not sure that the
effort porting actual C based kernel would be 'payed'
to achieve substantial results. What is really wrong is
using C in high level apps. I think that is better to
build a parallel version of Caml libraries to interact
directly with the kernel thru a Caml System Abstraction
Layer (CSAL), bypassing intermediate messy, fragmented,
specifical to C limitations libraries. Then at a second
stage when CSAL implemented and working, perhaps it
will be the time to replace the whole  C kernel. The
benefits of this aproach are:

1)legacy UNIX software will work seamlessy with the
traditional lib's support, or it would be necessary to
provide API compatibility to it.

2)CSAL will be designed to take full advantage of Caml
language (or not necessary to built it arround actual
lib design?). Full multithreading and dynamic linking 
should be provided to work properly with CSAL, an some
GC adaptations?.

3)Legacy Caml apps will also work seamlessy as pointed
in 1) with traditional libs. Moreover it will allow to
do 'mixed' apps.

4)GC timing overhead will be mitigated thru a more
'direct' acces to system resources (More than 90%+ of
time programs are excuting inside lib's code)
shortening the path to 'active code' and reducing the
number of calls needed to complete a usefull action. 

5) It seems me this strategy is not as radical as you
propose and don't put aside the idea of a 'total'
replacement, but doing it in two steps so with limited
Caml manpower would be more doable?. It also allow an
'incremental' developemt of CSAL with Caml, deprecating
old environment gradually as CSAL evolves. 

My proposal is a 3 layer model,

native-unix-kernel->CSAL->Caml apps.

to reach the final model,

caml-unix-kernel->CSAL->Caml apps.

Another important issue is that this SAL should be
be compliant with POSIXS or not?, or if we should have
full freedom to define it at the best to fit with Caml
features and more 'modern' design?.
My opinion favours the later, in spite it would take an
aditional step defining what's the 'modern' design is.
The pricipal drawback of this proposal is this CSAL
will be CAML propietary, as no third party languages
API's will be provided, nor it will intedended to do.
It will need maintaining support as UNIX kernel's
evolves. This fact will also constrain CSAL to kernel 
limitations.

I think that a project like this would need the
aproval, support and commitment of INRIA, and I don't know if this idea is barely considered in their plans,
prorities? (it seems me not).

Undoubtly OS design and languages, have a great 
importance and makes a big difference (productive
time /(productive time + wasted time)), on all stuffs
derived from them. It is unbeliable the ignorance and
misunderstanding I've found among industry IT's and
'engineers' who are still using CRAPS.   

Best Regards
Arturo


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: [Caml-list] Rewriting UNIX in Caml and getting rid of the C disease
@ 2001-11-21 21:25 Michael Hicks
  2001-11-22  3:10 ` Rafael 'Dido' Sevilla
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Hicks @ 2001-11-21 21:25 UTC (permalink / raw)
  To: Berke Durak, caml-list

Just to resurrect this thread:

Many of your observations on the inadequacies of C (and those of the
people who followed up) are addressed in a language being developed at
Cornell and AT&T Research called Cyclone.  It incorporates successful
high-level language features to ensure safety, but unlike most
high-level languages, gives the programmer control over data
representation and, to a large extent, memory management (e.g. a GC is
not required).  Furthermore, Cyclone is very close to C, thus
simplifying the process of porting legacy code (we actually parse a
superset of C, but our type-checker is more restrictive, as you would
imagine).  In essence, the language was designed with just your sort of
systems project in mind.  So far we have written a 40,000 line compiler
in Cyclone, and ported nearly 30,000 lines of systems code.

So that I'm not too off-topic, I should say that OCaml has been a strong
influence on Cyclone---many of the OCaml libraries and tools were ported
to Cyclone, and many of OCaml's features have been added to allow more
high-level programming, if desired, including exceptions, pattern
matching, tagged unions (i.e. datatypes), and others.  Of course,
"OCaml-like" is not OCaml itself; OCaml should be the language of choice
for applications where low-level control is not as important (of which
there are many).

http://www.cs.cornell.edu/projects/cyclone/ has more details.  There is
much
more to be done, and comments are welcomed.

Mike

> -----Original Message-----
> From: Berke Durak [mailto:berke@altern.org]
> Sent: Sunday, November 11, 2001 12:18 AM
> To: caml-list@inria.fr
> Subject: [Caml-list] Rewriting UNIX in Caml and getting rid of the C
> disease
> 
> 
> Everyone on this list will agree that the C language is far from being
> perfect. More specifically, if we consider its various derivatives
> together (i.e. the C preprocessor and C++) they form the worst piece
> of stinking, pathogen and toxic garbage in the realm of programming
> languages.
> 
> On the other hand, we almost all use and respect UNIX and its
> derivatives, which might seem to be a paradox, given that UNIX is
> entirely based on C.  I'm here considering UNIX from the system
> programmer's view, making abstraction of the way it's
> implemented. Certainly, it could get much better, but, practically, it
> is just fine.
> 
> Unfortunately, the C language acts as a mandatory layer over
> UNIX. Generating an executable for a given brand of UNIX without going
> thru the C library is tricky because it requires to know how the
> system calls work. These are, first, not documented (because you're
> supposed to go thru the C library), and, second, depend precisely on
> #ifdef-infested C source code, and are subject to revision.
> 
> Therefore, in the interests of humanity, I hereby propose that :
> 
>                               ***
> 
> An appropriate sublanguage of Caml should be isolated, and a given,
> well-accepted brand of UNIX should be reimplemented in that language.
> Binary compatibility must be retained as far as possible. Basic system
> utilities (including a shell) should also be translated (into full
> Ocaml). Since the use of Caml will, a) divide the source code size by,
> say, ten and b) automatically remove, say, 95% of all bugs and
> security holes (since most are illnesses resulting from pointer
> manipulation), success is guaranteed.
> 
>                               ***
> 
> Progress has to be made in operating systems. C blocks that progress.
> C must be obliterated.
> 
> The use and existence of a Caml-based UNIX, with a (justified)
> reputation of very good security and integrity, will invariably
> attract a lot of hackers (in the good sense) to Caml. It will also
> make existing Caml programmers a valuable resource.
> 
> The use of Caml might also facilitate the verification of some parts
> of it using Coq, even if I don't know what part of an operating system
> you could usefully verify by formal methods.
> 
> For marketing purposes, a bijective mapping between some sort of
> subgrammar of C and the sublanguage of Caml could be provided.
> 
> For people worrying about speed, I'd just remind them that not so long
> ago, C itself was considered pretty slow and inefficient a language
> (maybe the compilers weren't as good), yet operating systems 
> were written in C and used on computers a thousand times slower than
> what we have today.
> 
> Finally, the task of translating UNIX from C to Caml, if certainly
> not straightforward, is certainly feasible with a predictable amount
> of work, and could even be made semi-automatically.
> --
> Berke
> -------------------
> Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: 
http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives:
http://caml.inria.fr
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2001-11-22  3:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-11  5:17 [Caml-list] Rewriting UNIX in Caml and getting rid of the C disease Berke Durak
2001-11-11  6:11 ` Eric Newhuis
2001-11-11  8:22   ` Tom
2001-11-11 12:47 ` Sven
2001-11-11 13:32 ` Julian Assange
2001-11-12  8:32 ` Jeff Henrikson
2001-11-12 13:39 ` Mark Seaborn
2001-11-12 17:33   ` [Caml-list] GCCXML: don't write your own C parser. (WAS: Rewriting UNIX . . .) Jeff Henrikson
2001-11-13  0:53     ` Berke Durak
2001-11-13  5:10       ` Julian Assange
2001-11-12 21:52 [Caml-list] Rewriting UNIX in Caml and getting rid of the C disease Arturo Borquez
2001-11-21 21:25 Michael Hicks
2001-11-22  3:10 ` Rafael 'Dido' Sevilla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).