[fpc-pascal] Re: Porting linux to pascal, would it be possible ?

Prince Riley wmarketing3 at gmail.com
Sat Dec 6 02:57:19 CET 2008


I don't mean to start a culture war here, but I think there is a bit of
overstatement in this post that 'C' is somehow a better language for writing
an OS in than say Pascal or OP or anything else.

In point of fact, the only 'best' language for any processor is its own
machine code which is always binary.
And the first operating system software written was done so in the assembly
language which is written to use mnemoics
that when 'assembled' convert directly into the binary machine language on a
one to one basis.

Now EVERY compiled language, including  C, must be processed from its
syntactical representation into assembly language or machine code. In fact,
if you download the GCC complier source code and read it, you'll see  almost
immediately that it actually a 'language' front-end connected to a
'assembler machine code' back end.

When the 'C' language was designed at AT&T it used 'assembler' like
constructs and syntax because it's author wanted
to stop writing programs in a language called BCPL..

So aside from a 'historical accident'  that the first AT&T OS ..UNIX.. was
being written at the same time C was being developed, there is no other
reason for any program, including an OS, to be written in C. To suggest that
C is better is rather like suggesting that Spanish is a better language than
English for writing a novel.

That said, if someone wished to write a modern OS in FP, which has nearly
every programming construct that 'C' has (ints, doubles, floats, bytes, and
bits) and you were willing to put in the time to fine tune and modify the FP
compiler, you could produce a OS in FP that would be every bit as effective
and perform as well or better as one written in C.  And as far as the
processor running the OS couldn't tell what language the OS was written in.

If anyone wants to convince themselves on this its simple, you'll find
Ritchie (the creator of the C language) explained these points in the
preface to his first book on C. There is also a brief mention of this in the
Wikipedia article on the UNIX operating system. (see the article footnotes)


On Fri, Dec 5, 2008 at 6:59 PM, Guillermo Martínez Jiménez <
gmjimen at burdjia.com> wrote:

> > Are you sure?
> Yes, I am.
> > doesn't older MacOS's versions where written in Object Pascal?
> Yes, it does, but as I said I think it wasn't the better options.
> > I think the problem here (again) is not the language, it's the critical
> mass of users of the language. Using C for Linux was a good bet, not because
> the language is good (Pascal is way better for me), but because C has a
> wider user base who can fix/add features.
> I disagree.  C is better for write operating systems *by definition*:
> C was created to write UNIX, Pascal was created to learn good
> programming techniques.  C is low/mid-level language, Pascal is
> high-level (and Object Pascal is even higher):  OS are the lowest
> software level.
> I'm not saying it's impossible:  here you have MacOS and Toro. I'm
> just saying that _I think_ it isn't the best option.  Of course a
> better option is to write the kernel in C and Assembler and the
> utilities in Pascal and Object Pascal.
> Guillermo "Ñuño" Martínez
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20081205/74cc57b6/attachment.html>

More information about the fpc-pascal mailing list