[C++-sig] Questions/Comments about new stuff

Dave Hawkes daveh at cadlink.com
Wed Jul 17 17:40:04 CEST 2002


----- Original Message -----
From: "David Abrahams" <david.abrahams at rcn.com>
To: <c++-sig at python.org>; "Dave Hawkes" <daveh at cadlink.com>
Cc: "pysig" <c++-sig at python.org>
Sent: Wednesday, July 17, 2002 11:07 AM
Subject: Re: [C++-sig] Questions/Comments about new stuff


> A few more points:
>
> . Coding conventions - please try to follow the coding conventions
> established throughout the rest of the codebase.
> class_base::get_context_object() is an example of a function which does
all
> kinds of things differently. IOW, not this:
>
>     if(expr) {
>         ...
>     }
>
> but this, please:
>
>     if (expr)
>     {
>         ...
>     }
>
> Also, this function is much too big, dense, and deeply-nested. Comment
> lines should in general be preceded by a blank line. Many lines are too
> long. I wouldn't make such a big deal about this one, but I know I
> mentioned it as early as
> http://aspn.activestate.com/ASPN/Mail/Message/1230478.
>
Now that the API is in place I plan to revise this code as I should be able
to make it a little more compact. I'll tidy the style up at the same time. I
did revist the code since that discussion but it was difficult to pull out
many helper functions that would use the overall code apart from maybe a few
thing that would replicate what was being handle in the python API code.

> . What is going on with transfer_attributes()? I don't understand why it's
> there, yet. Why didn't you make it accept type_handle arguments instead of
> object? That would have made the code far simpler...
>
Again this can be reworked using the API code. This code is here so the
nesting order of classes doesn't impact their order of instantiation in the
module initialization.

> . Variable names like "r" for a type_handle don't say enough about its
> purpose to help the reader.
>
I think that one slipped through when I was changing a few other variable
names.

> I'm still reformatting and massageing this get_context_object() thing so I
> can get a feel for what it's doing...
>
It's still only around 30 lines of code excluding the comments and I may be
able to par it down further using the API code.

Dave Hawkes







More information about the Cplusplus-sig mailing list