Who needs exceptions (was Re: Two languages, too similar, competing in the same space.)

Cliff Wells logiplexsoftware at earthlink.net
Sun Dec 30 23:58:19 CET 2001


On 30 Dec 2001 14:36:28 +0100
Nils Kassube <nika at kassube.de> wrote:

> I never claimed that an OS should be written in Python. There are 
> several good all purpose languages who are better for this task,
> e.g. Lisp and Ada. 

Sorry, I was being somewhat facetious.  Unfortunately I am not familiar
with either Lisp or Ada so I can't comment on their appropriateness for
low-level work.  Since you aren't the first person I've heard advocate Ada
for this type of work, I have to wonder why it hasn't been done (or has
it?).  Lack of such an OS doesn't prove anything, but it does beg the
question.
 
> > develop run-of-the-mill applications in C.  Like any other language, C
has
> > places where it shines and places where it isn't really appropriate.
> 
> Yes, it really shines for security and stability problems. Heck, even
> bit-fiddling is better done using Ada. 

As I mentioned earlier, I don't know Ada, but I suspect insecure, unstable
software can be written in any language.  Familiarity with a language and
good design is the best way to avoid these problems.  This may be why C
retained its popularity for so long:  small language that's reasonably easy
to learn (both feature-wise and wart-wise).  As far as design, I will grant
that it can be difficult to maintain a good design in C for anything very
complex.  This is why I believe C to be a "better assembler".  Use it for
performance-critical code and then call it from a higher-level language
(like Python).

> BTW: 
> 
> int add_two_numbers(int a, int b){
>         return a+b;
> }
> 
> What's the meaning (semantics) of add_two_numbers(23575,23575)?

Hrm.  Don't like flaunting my ignorance on the list, but I don't see what
you're getting at.  On my 32-bit PC, it means 47150. 

I would say add_two_numbers() accepts two arguments of machine-word-size,
adds them and returns the machine-word-size result on the stack.  If the
result is greater than the machine-word-size, the result will be negative
(on a two's complement machine).  I'd probably return a long if that were
going to be an issue, or perhaps use an arbitrary-precision library.  

I think perhaps you are trying to point out something that I am too obtuse
to see.  Please feel free to enlighten me. 

Regards,


-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308




More information about the Python-list mailing list