<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><font size="4">I changed the subject</font>.</p>
<div class="moz-cite-prefix">Le 14/05/2022 à 17:49, Juan Vuletich a
écrit :<br>
</div>
<blockquote type="cite" cite="mid:627FCFA0.3090108@zoho.com"><br>
I think that #initialize should discard everything and start anew.<br>
</blockquote>
<p>I was lazy to tackle the problem now as it will make the class
more complex.<br>
</p>
<blockquote type="cite" cite="mid:627FCFA0.3090108@zoho.com"> Please
review the attach. It creates a new dictionary, populates it, and
only then installs it as the new ThePreferences. This is a pattern
that has been used in Squeak/Cuis many times.<br>
</blockquote>
<p>I don't really like much, it makes the class very verbose and
harder to understand, added redirections, but I don't have clear
workaround now. Analyzing now...<br>
I am wondering: could it be possible to put Cuis in hold while
initializing, it will avoid race condition, and kept the class
simple, hum not really fancy, no idea of the implication of a such
approach.<br>
Another idea is to use two class variables <font face="monospace"
color="#97082d">PreferenceReadAccess</font> and <font
face="monospace" color="#97082d">PreferenceWriteAccess</font>.
In normal operation the two reference the same Dictionary. During
initialization, they are decoupled and <font face="monospace"
color="#97082d">PreferenceWriteAccess</font> is set to a new
empty dictionary. <font face="monospace" color="#97082d">#at:</font>
and <font face="monospace" color="#97082d">#at:put:</font> will
be rewritten accordingly to use these variables.</p>
<p>It will keep the class simpler. I think I like this approach.<br>
</p>
<p>What do you think? If you agree I can make write the code.<br>
</p>
<p>Other observations:<br>
</p>
<p>The class method <font face="monospace" color="#97082d">#name:description:category:type:value:</font>
is needed, with it the user describes completely a new preference.
It is needed by external packages introducing their own
preferences. For example in the Locale package I have been porting
a few weeks ago there is:</p>
<p><font face="monospace" color="#97082d">Locale
class>>initialize<br>
Smalltalk addToStartUpList: Locale.<br>
PreferenceNG <br>
name: #useLocale<br>
description: 'Use the system locale to set the system
language, etc., at startup. For time-zone handling, see
automaticTimezone.'<br>
category: #system<br>
type: Boolean<br>
value: false</font><br>
</p>
<p>The instance creation method <font face="monospace"
color="#97082d">#name:category:value </font>is a shorter/lazy
one, where the system can deduce the type and no description is
provided. If one instance creation should be removed it could be
this one.<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:627FCFA0.3090108@zoho.com"> <br>
BTW, I removed #select:, and renamed #all to #allPreferences. I
think this makes the stuff easier to find with </blockquote>
<p><font face="monospace" color="#97082d">#select:</font> is needed
for a preference browser. Applications introducing a new category
of preferences (think #drgeo category for example) may want to use
this selector too. I think it should be reintroduced (with a
better name?) it will avoid to get it reintroduced in several
application package.</p>
<p>Good point on #all!</p>
<p>Thanks<br>
</p>
<p>Hilaire<br>
</p>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a class="moz-txt-link-freetext" href="http://drgeo.eu">http://drgeo.eu</a>
<a class="moz-txt-link-freetext" href="http://blog.drgeo.eu">http://blog.drgeo.eu</a></pre>
</body>
</html>