Message from discussion Why I Hate C
Received: by 10.224.31.20 with SMTP id w20mr2733943qac.2.1348190593147;
Thu, 20 Sep 2012 18:23:13 -0700 (PDT)
From: Giorgos Keramidas <keram...@ceid.upatras.gr>
Subject: Re: Why I Hate C
User-Agent: slrn/pre1.0.0-40 (Linux)
Date: 15 Sep 2012 16:38:32 GMT
Organization: SunSITE.dk - Supporting Open source
X-Trace: news.sunsite.dk DXC=bO`AD5l?NU84J8>`6Toe6=YSB=nbEKnk;1iFZNlRb2C:GYG:0;0_3?>o_>`WUg<`1:oJZA^dLN@m=^5EK=O1Lj]5oP;ITIn4[i9anHn2b<mAJ2
On 2012-09-11, Pascal J. Bourguignon <p...@informatimago.com> wrote:
>"Frode V. Fjeld" <frod...@gmail.com> writes:
>>> Second, why are other languages (e.g., Perl) written in C? I think I
>>> already know the answer to this one, but not really sure.
>> It's probably because Unix is effectively a "C" OS. Windows is
>> similar although leaning somewhat more towards C++ (while Microsoft
>> is trying to shift it to a Microsoft-only runtime). This fact
>> permeates both the technology and "software culture" on these systems
>> (including the popular "high-level" programming languages).
> Not really. Unix is a syscall OS. Syscalls are as hard to code in C
> as they are in Lisp. Actually, C needs an assembly library to call
> Now of course, that'd concern only the kernel. Libraries are also
> parts of the "OS", and since they're written in C, you want a C FFI to
> use them.
> But once you have the syscall API and the C FFI done, you don't have
> anything to do directly with C to write any language implementation.
The distinction between syscalls and library functions is kept
relatively 'clear' in well-formed UNIX systems. The manual pages of
'section 2' are explicitly marked as 'system calls'. The manual pages
of 'section 3' are also explicitly marked as 'library functions'.
The line is a bit blurry when libc.so is concerned, because it exports
symbols for *both* types of functions, but I fully agree iwth Pascal
here. Once you have a syscall layer and you have a way to write
user-level libraries on top of it, UNIX is not necessarily tied to C, or
to Lisp for that matter.
What's happening though is that as soon as you move outside of your own
'software bubble', and you _have_ to use someone else's code, the vast
majority of user-mode libraries for UNIX *are* written in C. Just like
if you are programming for the Android platform, it's far easier to find
libraries in Java instead of Objective Caml, or Fortran.