Open andreoss opened 4 years ago
@andreoss is the need to be able to print a Text
to an Output
?
I believe the printer concept is more about an object that takes a Text
in its print
method than the opposite as you propose.
WDYT?
@victornoel
We can think that Output
is a medium, and Text
prints itself to it.
It seems to be common in takes for an object to have two methods for print()
, the first one returns a string and the other one
writes to OutputStream
. 1. It could be
public void print(final OutputStream output) throws IOException {
new Print(this.text).print(new OutputOf(output));
}
@yegor256 what do you think about this discussion from a general EO point of view?
I wonder
Output
?Text
implements this interface?Output
really the object print
should take, since calling its stream
method can return fresh OutputStream
each time?
Is it possible to have a smart class for Text which realizes concept of printer? https://www.yegor256.com/2016/04/05/printers-instead-of-getters.html