[albatross-users] more data tricks for the wiki

Matt Goodall matt at pollenation.net
Thu Jul 3 19:02:35 EST 2003


Eric S. Johansson wrote:

> Gregory Bond wrote:
>
>>> <al-for iter="item" expr="list">
>>>
>>> where list is the list of sets and item is a single element from the 
>>> list.
>>
>> No, better to think of it as: item is a ListIterator object, 
>> item.value() is
>> a (reference to a) single element from the list.  
>
> my question for you is: at what point does the distinction between 
> ListIterator and a simple element created from the list contents 
> confuse the user and enlighten the user.
>
> There is a point that the early learning phase where this is not 
> important and in fact detracts from the user's ability to masterthe 
> basics.  There is some point later when it becomes important to have 
> the concept of ListIterator firmly in one's mind.  Can you define that 
> boundary? 

The fact that it is an iterator is *always* important. If it was not an 
iterator it would not support paging, you could not easily decide 
whether it was an odd or even row etc without keeping track of the count 
yourself. The features ListIterator provide are so common that Albatross 
simply makes it readily available.

>> Which implies "item" is not a great name for the iterator in an 
>> al-for loop!
>
> true.  But what else works? 

what about "iter"? Or "people_iter" when iterating over a list of people 
and you need to make the name of the iterator more specific because you 
have a nested <al-for>?

> It's a singleton containing your precious data and it is your 
> challenge to rip your data out of its evil clutches and cast the empty 
> ListIterator husk into the depths below.  (I guess that shows my frame 
> of mind) 

I can see you are enjoying yourself. This is how I feel whenever I have 
to do any PHP, it drives me insane ;-).

> seriously, from the user's perspective "item" is just that.  A single 
> item.

Ah, but as Greg pointed out that's what *you* called the iterator, not 
what Albatross called it.

> The user shouldn't have to care that it's an iterator when the 
> surrounding structure looks like a simple for loop.  if appearances 
> are deceiving, the user will resent being deceived. 

Hmm, that's an interesting point. Perhaps the *real* problem is that the 
tag is called <al-for> but doesn't behave like a Python for loop. 
Perhaps something like <al-iterate>would be better?

Cheers, Matt

-- 
Matt Goodall, Pollenation Internet Ltd
e: matt at pollenationinternet.com





More information about the Albatross-users mailing list