<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Okay, I was thinking that #add: would raise an error if the key is already present. But it doesn't and replace the value.</p>
<p>(Which I find a bit confusing because if the key is already present, it deletes the old value silently.)</p>
<p>The only method that raises an error if a key is already present seems to be Dictionary>>#newFrom:.</p>
<p><br>
</p>
<p>Maybe this commit should be edited (diff-diff):</p>
<p><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"></p>
<div>+ ----- Method: Dictionary class>>fromKeys:values: (in category 'instance creation') -----<br>
</div>
<div>+ fromKeys: keys values: values</div>
<div>+</div>
<div>+       | dictionary |</div>
<div>+       self assert: [keys size = values size].</div>
<div>+       dictionary := self new: keys size.</div>
<div>+       keys with: values do: [:key :value |</div>
<div></div>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">- +               dictionary add: key -> value].</span><br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"></span></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">+ +               </span><span style="font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">dictionary</span><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"></p>
<div>+ + <span style="white-space:pre"> </span>at: key</div>
<div>+ + <span style="white-space:pre"> </span>ifPresent: [:existing | self error: ('Duplicate key "{1}"' format: {key})]</div>
<div><span style="white-space:pre"><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">+ </span><span style="color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">+ </span>
</span>ifAbsentPut: value].</div>
</span>
<p></p>
<div>+       ^ dictionary!<br>
</div>
<div><br>
</div>
</span>
<p></p>
<p></p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com><br>
<b>Gesendet:</b> Sonntag, 17. November 2019 18:37:07<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Collections-ct.860.mcz</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Christoph,</div>
<div>I presume that Jakob is just suggesting using (at: key put: value) rather than (add: key -> value).<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le dim. 17 nov. 2019 à 17:36, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div id="gmail-m_5963684675944656004divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Thank you for the review! This was actually intended, or what would expect the following to do?</p>
<p><br>
</p>
<p><span style="color:rgb(33,33,33);font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont;font-size:15px">Dictionary fromKeys: 'wasda' values: '84265'</span><br>
</p>
<div id="gmail-m_5963684675944656004Signature">
<div name="divtagdefaultwrapper">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_5963684675944656004divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>>
 im Auftrag von Jakob Reschke <<a href="mailto:forums.jakob@resfarm.de" target="_blank">forums.jakob@resfarm.de</a>><br>
<b>Gesendet:</b> Sonntag, 17. November 2019 17:24:25<br>
<b>An:</b> <a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">
squeak-dev@lists.squeakfoundation.org</a><br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Collections-ct.860.mcz</font>
<div> </div>
</div>
<div>
<div dir="auto">
<div>Is there a strong indication to use add: anAssociation over at:put: here? The latter is more idiomatic and does not use the implementation detail that a dictionary is made up of associations. </div>
<div dir="auto"><br>
<br>
<div class="gmail_quote" dir="auto">
<div dir="ltr" class="gmail_attr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>> schrieb am Fr., 15. Nov. 2019, 13:59:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
A new version of Collections was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Collections-ct.860.mcz" rel="noreferrer noreferrer" target="_blank">http://source.squeak.org/inbox/Collections-ct.860.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-ct.860<br>
Author: ct<br>
Time: 15 November 2019, 1:58:56.418005 pm<br>
UUID: f6364e7f-08c8-694a-9060-21bc0a0c28d4<br>
Ancestors: Collections-pre.857<br>
<br>
Add convenience constructor for Dictionary<br>
<br>
Dictionary fromKeys: 'wasd' values: '8426'<br>
<br>
=============== Diff against Collections-pre.857 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Dictionary class>>fromKeys:values: (in category 'instance creation') -----<br>
+ fromKeys: keys values: values<br>
+ <br>
+       | dictionary |<br>
+       self assert: [keys size = values size].<br>
+       dictionary := self new: keys size.<br>
+       keys with: values do: [:key :value |<br>
+               dictionary add: key -> value].<br>
+       ^ dictionary!<br>
<br>
<br>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</div>
</body>
</html>