<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 29/04/2022 à 04:45, Luciano
Notarfrancesco via Cuis-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAL5GDyovKP_UG2e4Qb9Vd_byrf4OM-Cx=m8r4m5WR06JSNfo0w@mail.gmail.com">
<div dir="auto" style="border-color:rgb(0,0,0);color:rgb(0,0,0)">We
don’t want to check a value is of the correct type before
setting it, we just want to specify the type so that a GUI tool
for browsing and editing preferences can build appropriate
widgets for each preference (a drop down list, a toggle button,
etc). So the setter thing doesn’t make sense to me.</div>
</blockquote>
Well articulated.<br>
<blockquote type="cite"
cite="mid:CAL5GDyovKP_UG2e4Qb9Vd_byrf4OM-Cx=m8r4m5WR06JSNfo0w@mail.gmail.com">
<div dir="auto" style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><span
style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><br>
</span></div>
<div dir="auto" style="border-color:rgb(0,0,0);color:rgb(0,0,0)"><span
style="border-color:rgb(0,0,0);color:rgb(0,0,0)">The
dictionary as a class variable is a good idea to consider,
tho, since it avoids creating a special PreferrenceDictionary
class.</span><br>
</div>
</blockquote>
<p>One point to consider then is the interface to access and
manipulate the preferences.</p>
<p>In the class side of Preference we can have the infrastructure to
access/add preference instances. We can discuss how the protocol
will look like:<br>
</p>
<ul>
<li><font color="#941253">Preference at: #soundEnabled</font> or
more Smalltalkish <font color="#941253">Preference of:
#soundEnable</font></li>
<li><font color="#941253">Preference add: aPreferenceInstance</font>
looks odd, or better Preference instance creation should
auto-add the Preference instance to the dictionary, after all if
we create a Preference instance we want it to be kept by the
system, so the user should not need to specifically ask the
system to remember it: <br>
</li>
</ul>
<blockquote>Class method :<br>
</blockquote>
<blockquote>
<blockquote><font color="#97082d">Preference <br>
name: aSymbol <br>
description: aString <br>
category: aSymbol<br>
value: anObject <br>
type: aClassOrInstance</font> <br>
</blockquote>
create an instance and add it to the dictionary. In the instance
creation we can make mandatory the description string (refuse nil
or empty string).<br>
<br>
</blockquote>
<ul>
<li>Preference save: aSymbol to: aFileEntry, <br>
Preference saveCategory: aSymbol to: aFileEntry, <br>
Preference saveAllTo: aFileEntry<br>
Preference loadFrom: aFileEntry</li>
</ul>
<p>Gerald, do you see any limitation to load/save preferences when
the instances are in a class variable of Preference as Ken
suggested?</p>
<p>Let's continue the discussion.<br>
</p>
Hilaire<br>
<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>