Python for air traffic control?

Alex Martelli aleaxit at yahoo.com
Wed Jul 4 09:06:10 EDT 2001


"Mirko Liss" <mirko.liss at web.de> wrote in message
news:20010704013238.2DC8A00.NOFFLE at niccolo.ke4.de...
    ...
"""
If the arguments of a function are out of order, the compiler
should bark and die, shouldn´t it?
"""
I was taught "shud" is a four-letter word, to be avoided
in mixed company.

"""
Most programmers use type definitions deliberately, just to provoke
that kind of compile-time errors.
"""
In that case, most programmers' hopes are going to be frustrated,
if most programmers are working in C.

"""
An example in C:

typedef plane_t int ;  /* plane no */
typedef lane_t int  ;  /* lane no */
typedef go_down_in_pieces_t bool ;
go_down_in_pieces_t dispatch( plane_t flightno, \
                              lane_t neigboring_highway ) ;

If the arguments get swapped, the compiler gets angry.
Is this what you wanted to have in C ?
"""
If the compiler gets angry, then the compiler keeps its
emotions too bottled-up, and the compiler might be well
advised to see an analyst about it, because the compiler
is definitely giving no indication at all of its internal
emotional turmoil here.

In other words, quite apart from the fact that you're
apparently reversing the 2nd and 3rd arguments to the
various typedef's, AND labouring under the misconception
that there is a 'bool' keyword in C (there's one in C++,
and I don't know enough about C99 -- maybe they've
borrowed it?), there appears to be a fundamental error
or deep-misconception here... you *DO* know the most
elementary fundamentals of C, right?  Such as the fact
that type-equivalence is *BY STRUCTURE*, *NOT* by name,
and therefore no typedef is ever going to cause a failed
compilation because of two "int" arguments getting
swapped...?!  I.e., once we've fixed the obvious issues:

typedef int  plane_t;
typedef int  lane_t;
typedef int  bool;
typedef bool go_down_in_pieces_t;
go_down_in_pieces_t dispatch(
    plane_t flightno,
    lane_t neighboring_highway);

this will compile just fine...:

    plane_t krek = 23;
    lane_t pruk = 42;
    dispatch(pruk, krek);  /* oops... */


Oh, and -- that backslash you use is redundant.  Not
the major issue with your post, sure, but...


Alex






More information about the Python-list mailing list