From: Emmanuel S. [ES] <ma...@ei...> - 2007-10-25 16:18:02
|
> I would use `same_string' instead of `is_equal' in the > postconditions in order to avoid possible CAT-calls. Ok. > redefined in descendant classes.) Now I wonder what is wrong > with having these features introduced as deferred in class > STRING_GENERAL with a STRING_GENERAL as argument, and then > implement them as they are in STRING_8 and STRING_32 except > that we keep the argument of type STRING_GENERAL and we use > `s.code' instead of using `s.area.item' (this latter > implementation being erroneous anyway, even though more efficient). We did something similar with `append' in STRING_GENERAL. It was added in STRING_GENERAL as otherwise it was breaking too much code. Having those routines in STRING_GENERAL is ok, but I doubt anyone would use them. One would be crazy to develop a library where he is actually manipulating STRING_GENERAL. Although WEL and Vision2 are using STRING_GENERAL, they are just using them by passing, that is to say that they pass it to other functions or simply convert them to STRING_32 right away. To go back to starts_with and ends_with, I would simply rename the version from STRING_GENERAL in STRING_8 and STRING_32 the same way we do with `append' from STRING_GENERAL and keep what I've committed for the implementation. Most of the routines in STRING_8 are not made to take into account descendants, so descendants using the area differently should provide the correct implementation as it is already done for other routines. And if they don't, it won't be the first routines to have an incorrect implementation in descendants. Regards, Manu |