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

Re: ADT Lib (4.2) (is it 5 now?)



Hallo!

> Writers have no other state than position.  After writing an

I think its the other way round. It is more likely that the most
general writer export much less position information.

> So I'm proposing Writers be dropped and Readers be renamed
> to Enumerator or Iterator, in order to avoid confusing Oberonites.

No, don't do it.

> The functionality for modifying containers would be done as
> methods of each container.  Add() for Set, Push() for Stack, 
> and AddToFront(), AddToEnd(), and others for List, etc.
> This approach also makes simple containers much easier to 
> use -- no intermediate writer object needed.

You are confusing things. No one wants to make writers the only way to
add elements to a container. There will be of course special methods
for each ADT that handle adding and removing of elements. Write are
only used as automatic tool for generic data transfer.

> 3. May I suggest that the res variable in rider be "sticky" -- that is,
>  once it sets to a non-done value, it holds that value and the 
>  rider refuses to do any more work until r.ClearError is called.
>  This greatly simplifies programming since res doesn't need to
>  be checked after every operation.

There is another feature of STL iterators. On initialisation there are
not automatically positioned at the first element but they point before
the first element. You must iterate once (Next()) before getting a
valid position. I currently don't know why this was done. The oonly
reason I see is, that one can write:

while (iterator.next()) {
  // do somehing on current data
}

Note, that this also gives us an argument for splitting iteratoring
andvalue acess (a reproposel of methods Next() and Value()). Writing
loops over data is much simpler this way.

-- 
Gru...
       Tim.