[Xcb] _iterator functions

Jamey Sharp jamey at minilop.net
Mon Aug 17 10:11:15 PDT 2009


Questions about iterators apparently come up every two years, almost
like clockwork. Here are some past threads:

http://lists.freedesktop.org/archives/xcb/2005-December/001193.html
http://lists.freedesktop.org/archives/xcb/2007-May/002810.html
http://lists.freedesktop.org/archives/xcb/2007-June/002871.html
http://lists.freedesktop.org/archives/xcb/2007-November/003043.html

Would somebody please write this up on the wiki in a way that makes
sense to people who aren't me? I don't want to have to explain it again
in 2011. ;-)

I'm about to argue that there's as much justification for changing XCB's
iterators as there is for keeping them the way they've been. I'd like to
encourage you all to discuss what you really want here. I generally
prefer not to remove API but in this case if there were strong
consensus in that direction it'd probably be OK.

On Mon, Aug 17, 2009 at 12:54 AM, Barton C Massey wrote:
> Peter's patch made XIDs be treated just like any other CARD value; we
> don't generally generate iterators for these values anymore because of
> a previous patch;

As I recall, I didn't generate iterators for primitive types in the
original m4. If that's a sensible choice, then it seems consistent to
not use iterators for XIDs either.

I believe it was an accident of implementation though. The protocol
descriptions didn't describe the primitive types--those were wired into
the code generator. So my hooks for autogenerating iterators didn't run
for those types. XIDs and structs, on the other hand, are in the
descriptions, so they got iterators.

> IIRC no one could quite figure out why one would need an iterator to
> access an array of ints.

Of course, that argument can be extended to any fixed-length type--in
other words, any type that we provide array accessors for today.

The reason we decided to provide iterators for fixed-length compound
types, even though they aren't necessary, was so that people don't have
to think about which interface is supported for each type, most of the
time. I think that was one of those "conversations in Bart's office"
kind of decisions that informed a lot of XCB's structure, though you've
expressed the same thought on the list since.

Jamey


More information about the Xcb mailing list