From: Colin A. <col...@go...> - 2008-06-03 17:28:46
|
Franck and I have already discussed the frozen possibility, and came to the same conclusion as you did. What will the feature contents of immutable_string_general be? 2008/6/3 Emmanuel Stapf [ES] <ma...@ei...>: > Hi Colin, > > Eric and I had a discussion regarding your READABLE_STRING proposal. > Although it addresses the performance issue with substring it would not cope > very well with existing code. For example: > > s: READABLE_STRING > > io.put_string (s) > > would simply cause a conversion of `s' to STRING_8 and the memory benefit is > lost. > > Instead, we came up with the following hierarchy: > > deferred class READABLE_STRING_GENERAL > end > > deferred class STRING_GENERAL > inherit > READABLE_STRING_GENERAL > end > > deferred class READABLE_STRING_8 > inherit > READABLE_STRING_GENERAL > end > > deferred IMMUTABLE_STRING_GENERAL > inherit > READABLE_STRING_GENERAL > end > > class STRING_8 > inherit > READABLE_STRING_8 > STRING_GENERAL > end > > class IMMUTABLE_STRING_8 > inherit > READABLE_STRING_8 > IMMUTABLE_STRING_GENERAL > end > > The same for STRING_32. > > The benefit is that it does not break existing code, and in order to use > IMMUTABLE_STRING_8 efficiently in FreeELKS, it would be enough to use > READABLE_STRING_8 whenever a STRING_8 was expected and guaranteed to not be > modified. That way there is no more conversion involved. > > The only negative aspects of IMMUTABLE_STRING_8 is that a descendant of this > class could add some routines modifying the content of the string. A > solution would be to mark that class `frozen' but that would prevent someone > to add its own descendant in case IMMUTABLE_STRING_8 is missing some > functionality. Therefore we leave it as is (i.e. not frozen) and will put a > warning in the indexing clause to clearly state the danger of inheriting > from IMMUTABLE_STRING_8. > > Regards, > Manu > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > freeelks-devel mailing list > fre...@li... > https://lists.sourceforge.net/lists/listinfo/freeelks-devel > > |