Confusing Cursor Positions

"Brian Heilig" <Brian.Heilig-tdt4z+Mb/[email protected]>
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>

The wording of some of the cursor positions is a little confusing to 
me. Can someone clarify please? Here is `cursor_after' and 
`cursor_before'

cursor_after (a_cursor: like new_cursor): BOOLEAN is
    -- Is there no valid position to right of `a_cursor'?

This implies to me that if the condition is true, then `a_cursor' 
might be at the last position. If the cursor is at the last position 
then it is at a valid position, but there is no valid position to the 
right.

cursor_before (a_cursor: like new_cursor): BOOLEAN is
    -- Is there no valid position to left of `a_cursor'?

Likewise this implies to me that `a_cursor' might be at the first 
valid position. However `cursor_off' is defined in DS_BILINEAR as

cursor_off (a_cursor: like new_cursor): BOOLEAN is
    -- Is there no item at `a_cursor' position?
  do
    Result := cursor_after (a_cursor) or cursor_before (a_cursor)
  end

which shows that if `a_cursor' is after or before, then it can not be 
at a valid position. This seems confusing to me and it is not clear 
from the contract. In my opinion a better comment for cursor_after 
and cursor_before would be ...

cursor_after (a_cursor: like new_cursor): BOOLEAN is
    -- Is `a_cursor' after all valid items?

cursor_before (a_cursor: like new_cursor): BOOLEAN is
    -- Is `a_cursor' before all valid items?

... or something like that. Do you think my confusion is warranted, 
or is it my lack of understanding?

Thanks,
Brian Heilig






To Post a message, send it to:   [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/gobo-eiffel/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.