Re: intuitive concept of iter




On Feb 2, 2006, at 1:29 PM, zentara wrote:

Can anyone explain what an "iter" is?

It's short for "iterator", and is a thing that is used as a handle to an item in a collection. The idea is that using the iterator allows you to traverse the data structure without actually having to know or care about the actual details of the data structure.

Wikipedia says it much better than i:
http://en.wikipedia.org/wiki/Iterator

gtk+ uses iterators for the text and tree systems specifically to avoid the client program having to know the internals of those containers. This allows any object to implement the TreeModel interface (just provide the iters, the actual storage is up to you), and allows handling utf-8 text with tags and possibly-embedded items in the TextBuffer without client code having to worry about the complexities of that storage.

You might argue that the perl bindings for gtk+ should try to hide the iterators from the perl developers. You can get this sort of interface with Gtk2::Ex::Simple::TiedList and TiedTree. We decided against making the tied interface the standard because there were some things that were just impractical to do efficiently through the ties, and there's always that feeling of "there's probably a better way." For the TextView, i don't really know what a decent non-iter approach would be.



--
However, like all drugs, PANEXA can produce some notable side effects, all of which are probably really, really terrific and nothing that anyone should be concerned about, let alone notify any medical regulatory commission about.
  -- http://www.panexa.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]