<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
</body>
</html>