From: Eric B. <er...@go...> - 2007-05-24 11:58:04
|
Andreas Leitner wrote: >> Or should the indentation facility be part of KI_TEXT_OUTPUT_STREAM >> with an option to enable it or not? In fact we probably don't need >> an option, the fact that `indent' is never called (and hence >> `indentation' is kept to 0) should be enough. The questions are: >> is it acceptable to add 2 attributes to class KI_TEXT_OUTPUT_STREAM, >> and will the test to figure out that there is actually no indentation >> to be printed be noticeable in terms of performance? > > That would actually be nice, since you don't need to build a pipeline. > On the other hand, I think a pipeline is quite intuitive and easy to > build (once you know the pattern) and it spreads the functionality so > that KI_TEXT_OUTPUT_STREAM itself is more easy to understand. OK, so we have a "filter" that introduces indentation. Should KI_TEXT_OUTPUT_STREAM be implemented as a filter as well, which introduces new-lines to character output streams? It looks too heavy to me. So, where is the border-line between having things in the stream and other things in a filter? Also, for example for `put_character', the header-comment is not correct. It says nothing about the indentation. What would have happened if assertions could have been written to explicitly state that the character `v' and only this character was written? I understand that the filter pattern (it should have another name in the GoF book) is very convenient because we can add functionalities that we didn't think about when we wrote the class, and we can combine them together in different ways. The question is when should a functionality be added to the class and when should it be added to a filter. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |