<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<br>
<br>
<div class="moz-cite-prefix">On 8/19/21 5:58 PM, Juan Vuletich via
Cuis-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:611E7F96.1090901@jvuletich.org">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
On 8/14/2021 2:24 PM, Nicola Mingotti via Cuis-dev wrote:
<blockquote
cite="mid:df6137c9-8639-fcb7-11c9-2a13eeb71b41@gmail.com"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<br>
<font size="+1"><font face="monospace">Hi guys,<br>
<br>
I signal you that ReferenceStream class documentation is
outdated,<br>
the example it suggests fails. <br>
-----<br>
rr _ ReferenceStream fileNamed: 'test.obj'.<br>
rr nextPut: <your object>.<br>
rr close.<br>
-----<br>
<br>
I changed a bit the doc and added 2 convenience methods that
can be useful.<br>
<br>
---------- Example <br>
myObj _ {123. #('foo' 'bar' #(11 23 45)). }. <br>
ReferenceStream dumpOnFile: ('test1.obj' asFileEntry)
object: myObj . <br>
myObj _ nil. <br>
myObj _ ReferenceStream restoreFromFile: ('test1.obj'
asFileEntry ). <br>
myObj print. "=> #(123 #('foo' 'bar' #(11 23 45))) "<br>
----------<br>
<br>
I ask myself. Dump and restore are extremely useful methods.
Shouldn't we <br>
add these methods to Object itself ? [ Maybe they are
already there;P and I didn't see. ]<br>
<br>
<br>
bye<br>
Nicola<br>
<br>
</font></font></blockquote>
<br>
Hi Nicola,<br>
<br>
I just pushed this to GitHub. Note that I slightly modified the
code, using safer methods for file streams, that ensure: closing
the files.<br>
<br>
WRT adding helpers to Object, I feel that Object is already too
bloated. It is even more so in Squeak and other dialects. I
wouldn't add more stuff to Object unless absolutely needed.<br>
<br>
Thanks,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
</pre>
</blockquote>
Ok Juan, thanks.<br>
<br>
during the long Debian upgrade i red almost all the chapter
6-Objects of Lalonde book vol-1.<br>
i learnt Object has already "printOn:", so it actually has already
dump/restore capabilities.<br>
It is not "circle-safe" but that is another story. No need to add
more methods, agreed. The<br>
basic capability is there. <br>
<br>
bye<br>
Nicola<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>