<div dir="ltr"><div><div>But then, these are just the keys that you want:<br><br>
^(self allStandardVocabularies select: #representsAType) keys sort.<br><br></div>Or with the Preferences:<br><br></div> | vocabularyForType |<br> vocabularyForType := self allStandardVocabularies select: #representsAType.<br>
Preferences allowEtoyUserCustomEvents ifFalse: [vocabularyForType removeKey: #CustomEvents].<br> ^vocabularyForType keys sort<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/22 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>OK, I see the trick now.<br></div><div><br></div>Though collect:as: also works perfectly with an IdentityDictionary<br>
<br>((IdentityDictionary new)<br> at: 'foo' put: 2;<br> at: 'bar' put: 3;<br>
collect: #squared as: Array)<br>-><br>#(9 4)<br><br><br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/22 John McKeon <span dir="ltr"><<a href="mailto:p3anoman@gmail.com" target="_blank">p3anoman@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Finally getting back to this<br><div><div class="gmail_extra"><br><div class="gmail_quote"><div>
On Fri, Sep 6, 2013 at 4:21 PM, Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hmm, that was sort rather than sorted to sort in place.<br></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/9/6 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>That's the limit of select:thenCollect:, it would have to be declined into select:thenCollect:as:...<br>
<br></div>Anyway, #CustomEvents was a value of the Dictionary no?<br>So you would not expect removeKey: to remove a value, would you?<br></div></div></blockquote></div></div></div></div></blockquote><div> </div></div><div>
The keys are the same vocabularyName as that returned in the collect: block. See for instance Vocabulary class>>addStandardVocabulary: aVocabulary. So the associations created by the select:thenCollect: are of the form vocabularyName->vocabularyName.<br>
<br></div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>
<br>It could be:<br><br>aList := ((self allStandardVocabularies select: #representsAType) collect: #vocabularyName as: Array) sorted.<br>Preferences allowEtoyUserCustomEvents ifFalse: [^aList copyWithout: #CustomEvents].<br>
</div>^aList<br></div></blockquote></div></div></div></div></blockquote><div> <br></div></div><div>Sending collect: still gets you an IdentityDictionary which doesn't like as: Array. The original code returned aList asSortedArray. If we send that to the result of select:thenCollect: then use your copyWithout form it works as well. I've placed a new version of Protocols in the inbox with these changes.<br>
<br></div><div>Hopefully this version will appease the gods...<br><br></div><div>John<br></div><div><div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/9/6 Bob Arning <span dir="ltr"><<a href="mailto:arning315@comcast.net" target="_blank">arning315@comcast.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<font face="Georgia">The issue is that Dictionary>>collect:
used to return an OrderedCollection. Now it returns a Dictionary.<br>
<br>
Cheers,<br>
Bob<br>
<br>
</font><div><div>
<div>On 9/6/13 10:07 AM, Bert Freudenberg
wrote:<br>
</div>
<blockquote type="cite">
<pre>On 2013-09-06, at 08:21, Frank Shearar <a href="mailto:frank.shearar@gmail.com" target="_blank"><frank.shearar@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre>On 6 September 2013 00:59, <a href="mailto:commits@source.squeak.org" target="_blank"><commits@source.squeak.org></a> wrote:
</pre>
<blockquote type="cite">
<pre>A new version of Protocols was added to project The Inbox:
<a href="http://source.squeak.org/inbox/Protocols-jmck.44.mcz" target="_blank">http://source.squeak.org/inbox/Protocols-jmck.44.mcz</a>
==================== Summary ====================
Name: Protocols-jmck.44
Author: jmck
Time: 5 September 2013, 7:59:50.198 pm
UUID: c4a851ef-6f9c-6f43-b0f4-b4ff12060089
Ancestors: Protocols-fbs.43
Vocabulary class>>typeChoices throws an error if Preferences>>allowEtoysUserCustomEvents is false
Mantis #7786
=============== Diff against Protocols-fbs.43 ===============
Item was changed:
----- Method: Vocabulary class>>typeChoices (in category 'type vocabularies') -----
typeChoices
"Answer a list of all user-choosable data types"
| aList |
(aList := self allStandardVocabularies
select:
[:aVocab | aVocab representsAType]
thenCollect:
[:aVocab | aVocab vocabularyName]).
+ Preferences allowEtoyUserCustomEvents ifFalse: [aList removeKey: #CustomEvents].
- Preferences allowEtoyUserCustomEvents ifFalse: [aList remove: #CustomEvents ifAbsent: []].
^ aList asSortedArray!
</pre>
</blockquote>
<pre>I'm not in front of an image right now, but I find it a bit strange
that something Dictionary-y like #removeKey: is being sent to
something called "aList".
If aList will contain a Dictionary sometimes and a list-like
collection (Array, OrderedCollection) other times, first let me run
and hide in a corner so my crying doesn't upset anyone, and second
let's change the variable name to aListOrDictionary.
</pre>
</blockquote>
<pre>No, the proposed "fix" is just plain wrong.
#allStandardVocabularies answers an IdentityDictionary, and aList is an OrderedCollection (at least in the Etoys image) so the original #remove:ifAbsent: makes sense, whereas #removeKey: does not.
- Bert -
</pre>
</blockquote>
<br>
</div></div></div>
<br><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br><br>
<br></blockquote></div></div></div><span><font color="#888888"><br><br clear="all"><br>-- <br><a href="http://jmck.seasidehosting.st" target="_blank">jmck.seasidehosting.st</a>
</font></span></div></div></div>
<br><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>