<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</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>Hi John,</p>
<p><br>
</p>
<p>> <span style="font-size: 12pt;">By the way, I think that newUniqueClassInstVars: does something different from what you think it does. For one thing, the environment objects exist in is called EnvironmentForUniClass. In your example, o1 isn't instantiated
 properly, so copyFrom: finds o1 has no instVars so, it never copies the instVars to the new object.</span></p>
<div><br>
</div>
<div>No no, my fault was much more stupid: I forgot a #yourself in the cascade ... Adding that, the example works fine for #copySameFrom:.</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="_rp_T4" id="Item.MessagePartBody">
<div class="_rp_U4 ms-font-weight-regular ms-font-color-neutralDark rpHighlightAllClass rpHighlightBodyClass" id="Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</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 John Pfersich via Squeak-dev <squeak-dev@lists.squeakfoundation.org><br>
<b>Gesendet:</b> Dienstag, 7. Januar 2020 07:00:33<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Cc:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] Object >> #copyFrom: vs Object >> #copySameFrom:</font>
<div> </div>
</div>
<div>
<div>By the way, I think that <span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">newUniqueClassInstVars:
 does something different from what you think it does. For one thing, the environment objects exist in is called EnvironmentForUniClass. In your example, o1 isn't instantiated properly, so copyFrom: finds o1 has no instVars so, it never copies the instVars
 to the new object.</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;"><br data-mce-bogus="1">
</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">I
 fiddled around with the code and found that if I declare the objects in the System Browser the following code works:</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;"><br data-mce-bogus="1">
</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">c1
 := FooBar new. </span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">c1
 instVarNamed: 'foo' put: 6. </span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">c1
 instVarNamed: 'bar' put: 7. </span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;"><br data-mce-bogus="1">
</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">c2
 := BarFoo new. </span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">c2
 copySameFrom: c1. </span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">c2
 instVarAt: 2.</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">c1
 instVarAt: 2.</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;"><br data-mce-bogus="1">
</span></div>
<div><span style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;" data-mce-style="caret-color: #000000; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 13.333333015441895px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;">I
 couldn't get copyFrom: to work, the second instVar is nil. copyFrom: appears to only "work" when the instVars are at the same and in the same order. At least that's how I read it.</span></div>
<div><br>
On January 6, 2020 at 7:41 AM, "Thiede, Christoph" <Christoph.Thiede@student.hpi.uni-potsdam.de> wrote:<br>
<br>
</div>
<div>
<blockquote type="cite">
<div class="msg-quote" dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif;" dir="ltr" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif;">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;">
<p>You're right, this might be a more common case. But let me ask the other way around: What would be the disadvantage of extending the support for all types of class copies?</p>
<p>Metaprogramming must always be used with care, but I don't think this is an argument against implementing certain metaprogramming mechanisms ...</p>
<p><br>
</p>
<p>I think we should at least d<span style="font-size: 12pt;" data-mce-style="font-size: 12pt;">ocument the
</span><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;">difference between both selectors better.</span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;">My problem with #copyFrom: is its description to copy "<span>all instance variables I have in common with anotherObject".</span></span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"><span>The implementation does not really ensure the instance variables are declared in the same class and not a similar one. If we permit such incidents, we don't need to care for their order
 at all.</span></span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"><span><br>
</span></span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"><span>Best,</span></span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"><span>Christoph</span></span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"></span><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;">
<div style="font-family: Calibri,Arial,Helvetica,sans-serif; ; margin: 0;" data-mce-style="font-family: Calibri,Arial,Helvetica,sans-serif; ; margin: 0;">
<div><span size="2" color="#808080" data-mce-style="color: #808080; font-size: small;" style="color: #808080; font-size: small;"></span><br>
</div>
</div>
</div>
</div>
</div>
<hr style="display: inline-block; width: 98%;" data-mce-style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg" dir="ltr"><span face="Calibri, sans-serif" color="#000000" data-mce-style="font-size: 11pt; color: #000000; font-family: Calibri, sans-serif;" style="font-size: 11pt; color: #000000; font-family: Calibri, sans-serif;"><b>Von:</b> Squeak-dev
 <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Jakob Reschke <forums.jakob@resfarm.de><br>
<b>Gesendet:</b> Samstag, 4. Januar 2020 17:26:57<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] Object >> #copyFrom: vs Object >> #copySameFrom:</span>
<div> </div>
</div>
<div>
<div dir="ltr">I assume it does work for the intended use case. Probably converting between classes of the same hierarchy. That's where I used copySameFrom: once, to "dumb down" an object to one with less features (in this case: mutation methods).</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Am Sa., 4. Jan. 2020 um 17:21 Uhr schrieb Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" data-mce-href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>>:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;" data-mce-style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">
<div>
<div id="gmail-m_1648367796741277813divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;">
<p>@Jakob: I know that. But if we have an implementation, it should be right, shouldn't it? And this is commonly used in Object >> #as: or Object class >> #newFrom:.</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<div id="gmail-m_1648367796741277813Signature">
<div id="gmail-m_1648367796741277813divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;">
<div>
<div>
<div id="gmail-m_1648367796741277813Item.MessagePartBody">
<div id="gmail-m_1648367796741277813Item.MessageUniqueBody" style="font-family: wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif,serif,EmojiFont;" data-mce-style="font-family: wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif,serif,EmojiFont;">
<div dir="ltr">
<div id="gmail-m_1648367796741277813divtagdefaultwrapper"><span face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" data-mce-style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;">
<div id="gmail-m_1648367796741277813Signature">
<div style="margin: 0px;" data-mce-style="margin: 0px;"><span data-mce-style="font-family: Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont;" style="font-family: Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont;">
<div><span size="3" color="black" data-mce-style="color: black; font-size: medium;" style="color: black; font-size: medium;"><span style="font-size: 12pt;" data-mce-style="font-size: 12pt;"><a href="http://www.hpi.de/" id="gmail-m_1648367796741277813LPNoLP" data-mce-href="http://www.hpi.de/"><span size="2" data-mce-style="font-size: small;" style="font-size: small;"><span id="gmail-m_1648367796741277813LPlnk909538"><span color="#757B80" data-mce-style="color: #757b80;" style="color: #757b80;"></span></span></span></a></span></span><br>
</div>
</span></div>
</div>
</span></div>
</div>
</div>
</div>
</div>
<div><span size="2" color="#808080" data-mce-style="color: #808080; font-size: small;" style="color: #808080; font-size: small;"></span><br>
</div>
</div>
</div>
</div>
</div>
<hr style="display: inline-block; width: 98%;" data-mce-style="display: inline-block; width: 98%;">
<div id="gmail-m_1648367796741277813divRplyFwdMsg" dir="ltr"><span face="Calibri, sans-serif" color="#000000" data-mce-style="font-size: 11pt; color: #000000; font-family: Calibri, sans-serif;" style="font-size: 11pt; color: #000000; font-family: Calibri, sans-serif;"><b>Von:</b>
 Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" data-mce-href="mailto:squeak-dev-bounces@lists.squeakfoundation.org">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von Jakob Reschke <<a href="mailto:forums.jakob@resfarm.de" data-mce-href="mailto:forums.jakob@resfarm.de">forums.jakob@resfarm.de</a>><br>
<b>Gesendet:</b> Samstag, 4. Januar 2020 17:18:58<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] Object >> #copyFrom: vs Object >> #copySameFrom:</span>
<div> </div>
</div>
<div>
<div dir="ltr">Keep in mind that copying the variables by name to an *unrelated* class breaks encapsulation and relying on the copying couples the classes tightly.
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Am Sa., 4. Jan. 2020 um 16:03 Uhr schrieb Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" data-mce-href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>>:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;" data-mce-style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">
<div dir="ltr">
<div id="gmail-m_1648367796741277813gmail-m_2272617115244714960divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri, Helvetica, sans-serif, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;">
<div id="gmail-m_1648367796741277813gmail-m_2272617115244714960divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;">
<p>Hi Levente,</p>
<p><br>
</p>
<p>yes, that would look more intuitive for me. Why else should any of these methods ask for #allInstVarNames?</p>
<p><br>
</p>
<p>I would like to propose something like this:</p>
<p><br>
</p>
</div>
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" data-mce-style="margin: 0px 0px 0px 40px; border: none; padding: 0px;">
<div dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;">
<p><br>
</p>
<div>copyFrom: anotherObject</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>"Copy to myself all instance variables I have in common with anotherObject.  This is dangerous because it ignores an object's control over its own inst vars.  "</div>
<div><br>
</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>| otherInstVars |</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span><primitive: 168></div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>otherInstVars := (anotherObject class allInstVarNames</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>withIndexCollect: [:name :index | name -> (anotherObject instVarAt: index)])</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>as: Dictionary.</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>self class allInstVarNames withIndexDo: [:name :index |</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>otherInstVars at: name ifPresent: [:value |</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>self instVarAt: index put: value]].</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>(self class isVariable and: [anotherObject class isVariable]) ifTrue: [</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>1 to: (self basicSize min: anotherObject basicSize) do: [:ind |</div>
<div><span style="white-space: pre-wrap;" data-mce-style="white-space: pre-wrap;"></span>self basicAt: ind put: (anotherObject basicAt: ind)]].</div>
<p><br>
</p>
</div>
</blockquote>
<div dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;" data-mce-style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif,EmojiFont,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols;">
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<br>
<div style="color: #000000;" data-mce-style="color: #000000;">
<div>
<hr style="display: inline-block; width: 98%;" data-mce-style="display: inline-block; width: 98%;">
<div id="gmail-m_1648367796741277813gmail-m_2272617115244714960x_divRplyFwdMsg" dir="ltr">
<span face="Calibri, sans-serif" color="#000000" data-mce-style="font-size: 11pt; color: #000000; font-family: Calibri, sans-serif;" style="font-size: 11pt; color: #000000; font-family: Calibri, sans-serif;"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" data-mce-href="mailto:squeak-dev-bounces@lists.squeakfoundation.org">squeak-dev-bounces@lists.squeakfoundation.org</a>>
 im Auftrag von Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" data-mce-href="mailto:leves@caesar.elte.hu">leves@caesar.elte.hu</a>><br>
<b>Gesendet:</b> Samstag, 4. Januar 2020 04:34 Uhr<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] Object >> #copyFrom: vs Object >> #copySameFrom:</span>
<div> </div>
</div>
</div>
<span size="2" data-mce-style="font-size: small;" style="font-size: small;"><span style="font-size: 10pt;" data-mce-style="font-size: 10pt;">
<div>Hi Christoph,<br>
<br>
On Sat, 4 Jan 2020, Thiede, Christoph wrote:<br>
<br>
> <br>
> Hi Levente, thanks for the feedback.<br>
> <br>
> <br>
> > What's your use-case?<br>
> Actually not a real use case, I was just confused by the confusion of both methods.<br>
> <br>
> But I would find it cool if my first code example would work, for the best support of converting arbitrary objects between each other.<br>
<br>
It's not clear to me what the expected result of your first example is. Is <br>
it that instance variables are copied by name?<br>
<br>
<br>
Levente<br>
<br>
> <br>
> Best,<br>
> Christoph<br>
> <br>
> _________________________________________________________________________________________________________________________________________________________________________________________________________________________________<br>
> Von: Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" data-mce-href="mailto:squeak-dev-bounces@lists.squeakfoundation.org">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" data-mce-href="mailto:leves@caesar.elte.hu">leves@caesar.elte.hu</a>><br>
> Gesendet: Freitag, 3. Januar 2020 23:14:07<br>
> An: The general-purpose Squeak developers list<br>
> Betreff: Re: [squeak-dev] Object >> #copyFrom: vs Object >> #copySameFrom:  <br>
> Hi Christoph,<br>
> <br>
> On Fri, 3 Jan 2020, Thiede, Christoph wrote:<br>
> <br>
> ><br>
> > Hi Levente,<br>
> ><br>
> ><br>
> > I don't get that.<br>
> ><br>
> ><br>
> > Did I interpret your explanation correctly?<br>
> <br>
> Yes, you did. I just checked why it doesn't work, and it turned out I<br>
> misremembered how it actually works.<br>
> The primitive's comment is:<br>
> <br>
>          Copy the state of the receiver from the argument.<br>
>                  Fail if receiver and argument are of a different class.<br>
>                  Fail if the receiver or argument are contexts (because of context-to-stack mapping).<br>
>                  Fail if receiver and argument have different lengths (for indexable objects).<br>
>                  Fail if the objects are not in a fit state to be copied (e.g. married contexts and Cogged methods<br>
> <br>
> So, it'll fail, because the classes are not the same (an artifical<br>
> limitation IMO).<br>
> The fallback code will only copy slots of the same index if they have the<br>
> same name (also an artificial limitation).<br>
> <br>
> What's your use-case?<br>
> <br>
> <br>
> Levente<br>
> <br>
> ><br>
> ><br>
> >       fooClass := Object newUniqueClassInstVars: 'a b' classInstVars: ''.<br>
> > barClass := Object newUniqueClassInstVars: 'b c' classInstVars: ''.<br>
> > foo := fooClass new.<br>
> > bar := barClass new<br>
> > instVarNamed: #b put: 2;<br>
> > instVarNamed: #c put: 3;<br>
> > yourself.<br>
> > foo copyFrom: bar.<br>
> > foo instVarNamed: #b "expected: 2, actual: nil"<br>
> ><br>
> ><br>
> > Otherwise, if I put #b as the first instvar in both classes, #copyFrom: and #copySameFrom: won't differ again ...<br>
> ><br>
> ><br>
> > Best,<br>
> ><br>
> > Christoph<br>
> ><br>
> ><br>
> >________________________________________________________________________________________________________________________________________________________________________________________________________________________________<br>
> _<br>
> > Von: Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" data-mce-href="mailto:squeak-dev-bounces@lists.squeakfoundation.org">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" data-mce-href="mailto:leves@caesar.elte.hu">leves@caesar.elte.hu</a>><br>
> > Gesendet: Freitag, 3. Januar 2020 19:05 Uhr<br>
> > An: The general-purpose Squeak developers list<br>
> > Betreff: Re: [squeak-dev] Object >> #copyFrom: vs Object >> #copySameFrom:  <br>
> > Hi Christoph,<br>
> ><br>
> > The two methods are different. #copyFrom: copies variables by index while<br>
> > #copySameFrom: copies variables by name.<br>
> > So, if you have an object named foo of class Foo with 2 instance variables<br>
> > a and b, and an object named bar of class Bar with 2 instance variables b<br>
> > and c, then foo copyFrom: bar will copy bar's b to foo's a, and bar's c to<br>
> > foo's b. #copySameFrom: will copy bar's b to foo's b and leave foo's a as<br>
> > is.<br>
> ><br>
> > Levente<br>
> ><br>
> ><br>
> > On Fri, 3 Jan 2020, Thiede, Christoph wrote:<br>
> ><br>
> > ><br>
> > > Hi all,<br>
> > ><br>
> > ><br>
> > > I don't get the actual difference between #copyFrom: and #copySameFrom:.<br>
> > ><br>
> > ><br>
> > > The latter looks more "modern" to me, as it uses a primitive and has several implementors.<br>
> > ><br>
> > > In my opinion, none of them actually matches its description ("Copy to myself all instance variables [named the same in | I have in common with] otherObject"). The following leaves o2 empty:<br>
> > ><br>
> > ><br>
> > > c1 := Object newUniqueClassInstVars: 'foo bar' classInstVars: ''.<br>
> > > c2 := Object newUniqueClassInstVars: 'bar foo' classInstVars: ''.<br>
> > > o1 := c1 new<br>
> > > instVarNamed: #foo put: 6;<br>
> > > instVarNamed: #bar put: 7.<br>
> > > o2 := o1 as: c2.<br>
> > > o2 instVarAt: 1 "nil".<br>
> > ><br>
> > > o2 copySameFrom: o1.<br>
> > > o2 instVarAt: 1 "nil".<br>
> > ><br>
> > ><br>
> > > Question: Could we deprecate #copySameFrom:, and in #copyFrom:, copy *all* matching instvars without respecting their order? Or did I miss any intended difference in behavior?<br>
> > ><br>
> > > Best,<br>
> > > Christoph<br>
> > ><br>
> > ><br>
> > ><br>
> ><br>
> ><br>
> <br>
></div>
</span></span></div>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</div>
</div>
<div class="_stretch"><span class="body-text-content"><br>
</span></div>
<style class="existing-message-styles" type="text/css">.msg-quote P {margin-top: 0px; margin-bottom: 0px;}
</style></div>
</blockquote>
</div>
</div>
</body>
</html>