Is this a true statement? (fwd)

David C. Ullrich ullrich at math.okstate.edu
Sun Jun 24 09:54:13 EDT 2001


On Sat, 23 Jun 2001 12:45:26 -0400, Lulu of the Lotus-Eaters
<mertz at gnosis.cx> wrote:

>>But you can't *DO* all of the same things in all languages -- for
>>example: you can write a device driver in a language if you can't
>>specify interrupt vectors or hardware address pointers.
>
>David C. Ullrich wrote:
>|I thought a device driver was just a file, hence a finite
>|sequence of bytes. You can certainly use Python to write an
>|arbitrary sequence of bytes to a file. No doubt it's much easier
>|in C++ (or rather in typical implementations of C++?) to decide
>|_what_ sequence of bytes to write to that file
>
>One particular program would could write in Python is called a "C++
>compiler".  While this would not be a particularly *easy* program to
>write, you *could* write a script called 'gcc.py' that took all the same
>arguments and input *data* files as a program called 'gcc', and produced
>as a result bit-identical outputs.  This may be a somewhat cumbersome
>approach to writing a device driver in Python, but...

Indeed. We don't need all of the compiler. Clearly it _is_ much
_easier_ to write a device driver in C, or people would not say
that it's impossible to do it in Python. But there's nothing
about _C_ that writes device drivers, if it's easier there it's
because the _implementation_ has inside information.

>Yours, Lulu...

It's been suggested that I'm making a silly point here. Could
be a point with essentially no practical significance. Or it
could be that while there's essentially no importance here
regarding device drivers per se, there _is_ a serious point
to it all.

For example, I've seen it stated several times that if
you're writing Windows programs you have to be writing
C or C++ because the API is written in C. This is simply
not true, you can write Windows programs in any language
you like, and with no silliness involved. I doubt that
the people who wrote the things I read actually think
that for some reason you cannot use Delphi to write
Windows programs, but someone reading a flat statement
"You have to write Windows in C" might think it was
true.

(The _documentation_ is in C. And C compilers from
Microsoft just happen to know a lot about the
Windows API. But the documentation contains a language-
independent specification of what a Windows program
is supposed to do. Although the word "specification"
might be a little strong, that has nothing to do
with C versus some other language.)


David C. Ullrich
*********************
"Sometimes you can have access violations all the 
time and the program still works." (Michael Caracena, 
comp.lang.pascal.delphi.misc 5/1/01)



More information about the Python-list mailing list