I wanted to take a second to close the book on this. It turns out that
storeOn:/readFrom: are not supposed to be symmetrical. printOn:/readFrom: are
supposed to be symmetrical.
storeOn: generates a string that can be fed into the interpreter/compiler such
that when it is executed an instance
I wouldn't rely on such symmetry.
Given the fact #printOn: is the only printing instrumentation
available to show objects in debuggers, inspectors, etc. Most of the
times it just shows a short representation of the object, not very
useful to recreate an instance from such short string.
Regards,
On 23/5/14 19:58, Rick Kitts wrote:
Hi. A basic question I hope someone can answer. This works:
— cut here ---
| stream aInt |
stream := (String new:20) writeStream.
aInt := 23.
(aInt storeOn:stream) = (aInt class readFrom:(stream contents))
— cut here ---
This doesn’t (generates an error):
Hi. A basic question I hope someone can answer. This works:
— cut here ---
| stream aInt |
stream := (String new:20) writeStream.
aInt := 23.
(aInt storeOn:stream) = (aInt class readFrom:(stream contents))
— cut here ---
This doesn’t (generates an error):
— cut here ---
| stream aTime |