Lies in education [was Re: The "loop and a half"]

bartc bc at freeuk.com
Wed Oct 11 15:53:35 EDT 2017


On 11/10/2017 20:30, Chris Angelico wrote:
> On Thu, Oct 12, 2017 at 3:29 AM, Rhodri James <rhodri at kynesim.co.uk> wrote:
>> On 11/10/17 15:36, Chris Angelico wrote:

>> That's only really one level more complex than declarations I use fairly
>> regularly (I am an embedded system programmer most of the time).  On the
>> other hand, I never actually do declare things in that way: typedef is your
>> friend, and makes your C code much easier to read.
> 
> I wouldn't consider embedded systems to be the most common kind of C
> coding out there, particularly when people compare against C++ (I
> don't remember ever hearing of anyone doing embedded work in C++,
> though I'm sure it does happen). Nevertheless, you're exactly right
> about the typedefs. Writing crazily complicated type declarations
> without typedefs is like writing massively nested list comprehensions
> without intermediate variables. Hey look, Python's terrible! Or maybe
> they're just non-idiomatic examples.

Look at my last example posted a few minutes before this.

You'd say the C needed typedefs.

But in the original language, type declarations are clear enough that 
they don't need typedefs.

The typedefs help to mitigate a problem in one language that doesn't 
exist in the other. Surely it's better to have neither the cryptic type 
nor the typedef. Everything would be much cleaner.

-- 
bartc





More information about the Python-list mailing list