Errors caught by gelint in XM_XPATH classes

Eric Bezault <[email protected]>
Newsgroups gmane.comp.lang.eiffel.gobo.devel
Message-ID <[email protected]>
Gelint reports the following errors:

[VUAR-2] class XM_XPATH_ARRAY_LIST_ITERATOR (33,25): the 1-th actual 
argument (of type 'NONE') does not conform to the corresponding formal 
argument (of type 'G') of feature `has' in class DS_ARRAYED_LIST.
----
[VUAR-2] class XM_XPATH_ARRAY_LIST_ITERATOR (46,25): the 1-th actual 
argument (of type 'NONE') does not conform to the corresponding formal 
argument (of type 'G') of feature `has' in class DS_ARRAYED_LIST.
----
[VUAR-2] class XM_XPATH_ARRAY_LIST_ITERATOR (205,21): the 1-th actual 
argument (of type 'NONE') does not conform to the corresponding formal 
argument (of type 'G') of feature `has' in class DS_ARRAYED_LIST.
----
[VUAR-2] class XM_XPATH_REVERSE_ARRAY_LIST_ITERATOR (33,25): the 1-th 
actual argument (of type 'NONE') does not conform to the corresponding 
formal argument (of type 'G') of feature `has' in class DS_ARRAYED_LIST.
----
[VUAR-2] class XM_XPATH_REVERSE_ARRAY_LIST_ITERATOR (46,25): the 1-th 
actual argument (of type 'NONE') does not conform to the corresponding 
formal argument (of type 'G') of feature `has' in class DS_ARRAYED_LIST.
----
[VUAR-2] class XM_XPATH_REVERSE_ARRAY_LIST_ITERATOR (174,21): the 1-th 
actual argument (of type 'NONE') does not conform to the corresponding 
formal argument (of type 'G') of feature `has' in class DS_ARRAYED_LIST.
----

One way to solve this problem is to use inline agents ;-)))
Anyway, the assertions are obviously wrong, it should be:

   no_void_item: not a_list.has (Void)
                 ^^^
Probably not caught earlier because of the bug in gexace.

OK, I can feel the fact that you don't want to use inline
agents. So, there are several other solutions.

1) Add a routine `has_default' in class DS_SEARCHABLE.

2) Add a routine `default_item: G' in your class and
    call: not a_list.has (default_item). But this will
    not be practical for assertions in creation routines.

3) Use KL_ANY_ROUTINES.same_objects:
     not a_list.there_exists (agent ANY_.same_objects (?, Void))

Solution 3 is the one which will work without any additional
code.

PS: I would tend to avoid declaring the generic parameter
as 'reference G' because it is not part of ECMA Eiffel is
I remember correctly.

-- 
Eric Bezault
mailto:[email protected]
http://www.gobosoft.com

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
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.