<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>Hi all,</p>
<p><br>
</p>
<p>> <span style="font-size: 12pt;">And canUnderstand: ?  Or is that being too picky?</span></p>
<p><br>
</p>
<p>> <span style="font-size: 12pt;">If the doesNotUnderstand: is not visible externally then who cares?  Isn't the contract (o respondsTo: m) ifFalse: [self should: [o m] raise: MessageNotUnderstood]], or respondsTo: not implies MNU ?</span></p>
<div><br>
</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">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" target="_blank" rel="noopener noreferrer" id="LPNoLP"><font size="2"><span id="LPlnk909538"><font color="#757B80"></font></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">Well, my conception of the general contract would be exactly the following:</div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">(o class canUnderstand: m) ifTrue: [</div>
<div class="_rp_T4" id="Item.MessagePartBody">    self assert: [o respondsTo: m]].</div>
<div class="_rp_T4" id="Item.MessagePartBody">
<div class="_rp_T4" id="Item.MessagePartBody" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
(o respondsTo: m) ifFalse: [</div>
<div class="_rp_T4" id="Item.MessagePartBody" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
    self deny: [o class canUnderstand: m]].</div>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">(o respondsTo: m) ifTrue: [</div>
<div class="_rp_T4" id="Item.MessagePartBody">    self shouldnt: [o m] raise: MessageNotUnderstood].</div>
<div class="_rp_T4" id="Item.MessagePartBody">[o m] on: MessageNotUnderstood do: [</div>
<div class="_rp_T4" id="Item.MessagePartBody">    self deny: [o respondsTo: m]].</div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">But I would *not* require the other direction of the implication - for #canUnderstand:, this is simply not possible for dynamic forwarding (unless we make false promises on the class side), and in my opinion, the
 current discussion shows that the same argument applies for the second statement, too.</div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">> <span style="font-size: 12pt;">I would like to keep the JSON library as simple as possible. Wer are just talking about syntactic sugar here, right?</span>
<div><br>
</div>
<div>IMHO, this goes beyond syntactic sugar. :-) As I tried to explain below, a proper implementation of #respondsTo: could be an essential prerequisite for using JsonObjects polymorphically with first-class object instances. In my use case, this is a crucial
 feature and if my proposal is discarded, I will have to subclass JsonObject ...</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
<span></span></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 Taeumel, Marcel<br>
<b>Gesendet:</b> Dienstag, 10. November 2020 09:34:49<br>
<b>An:</b> squeak-dev<br>
<b>Betreff:</b> Re: [squeak-dev] I'd like to contribute to the JSON project</font>
<div> </div>
</div>
<div>
<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">and generate the getter setter on demand (via doesNotUnderstand:)</span>
<div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br>
</span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">That's what I opted for, too, in: </span><span style="font-size: 10pt;font-family: Arial, Helvetica, sans-serif"><a href="https://github.com/hpi-swa/MessageSendRecorder" style="font-size: 10pt">https://github.com/hpi-swa/MessageSendRecorder</a> 's
 MessageSendRecordExtension.</span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px"><br>
</span></span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">Best.</span></span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">Marcel</span></span></div>
<div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
<p style="color: #AAAAAA; margin-top: 10px;">Am 10.11.2020 09:32:07 schrieb Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr">
<div>Hi all,</div>
<div>for importing Matlab struct, I create classes on the fly and generate the getter setter on demand (via doesNotUnderstand:)<br>
</div>
<div>See MatFileReader package in <a href="http://www.squeaksource.com/STEM.html">
http://www.squeaksource.com/STEM.html</a><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le mar. 10 nov. 2020 à 09:06, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.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 id="gmail-m_1016619184551391444__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
> <span style="font-size: 10pt">And canUnderstand: ? Or is that being too picky?</span>
<div><span style="font-size: 10pt"><br>
</span></div>
<div><span style="font-size: 10pt">Ah, right. On the class level, it would be like Levente inferred from my suggestion. I only thought of #respondsTo: to answer "true" only for the simple setter/getters that have keys present in the actual dictionary instance.
 Hmmm.....</span></div>
<div><span style="font-size: 10pt"><br>
</span></div>
<div><span style="font-size: 10pt">I would like to keep the JSON library as simple as possible. Wer are just talking about syntactic sugar here, right?</span></div>
<div><span style="font-size: 10pt"><br>
</span></div>
<div><span style="font-size: 10pt">Best,</span></div>
<div><span style="font-size: 10pt">Marcel</span></div>
<div></div>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
<p style="color:rgb(170,170,170);margin-top:10px">Am 09.11.2020 21:08:14 schrieb Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_default" style="font-size: 14pt"><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Nov 8, 2020 at 11:04 PM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;min-width:500px">
<div id="gmail-m_1016619184551391444m_8296749452181339386gmail-m_-7958462234810674208__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
Hi Levente.
<div><br>
</div>
<div>Sounds right. If an object can answer to some extra messages via #doesNotUnderstand:, one should also override #respondsTo:. It is like #= and #hash.</div>
</div>
</blockquote>
<div><br>
</div>
<div class="gmail_default" style="font-size: 14pt">And canUnderstand: ?  Or is that being too picky?</div>
<div class="gmail_default" style="font-size: 14pt"><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;min-width:500px">
<div id="gmail-m_1016619184551391444m_8296749452181339386gmail-m_-7958462234810674208__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
<div><br>
</div>
<div>I did not know about #dictionaryClass:. That's a powerful hook.</div>
<div><br>
</div>
<div>Best,</div>
<div>Marcel</div>
<div></div>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
<p style="color:rgb(170,170,170);margin-top:10px">Am 09.11.2020 03:07:54 schrieb Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">Hi Christoph,<br>
<br>
On Sun, 8 Nov 2020, Christoph Thiede wrote:<br>
<br>
> Hi Levente,<br>
><br>
> would you mind to merge JSON-ct.41 (#respondsTo:) as well? This would be<br>
> great because I depend on this functionality in another project and<br>
> currently require your JSON fork in my baseline. :-)<br>
<br>
I cannot merge it because that would bring back long removed methods, and<br>
MC wouldn't allow me to reject those.<br>
But I can add the changes manually.<br>
If I'm not mistaken, it's just a single method JsonObject >> #respondsTo:.<br>
<br>
What is the purpose of that method?<br>
I'm asking because it has got no comment, so I'm not sure its <br>
implementation is correct.<br>
For example, should<br>
<br>
JsonObject new respondsTo: #foo:<br>
<br>
return false?<br>
What should the following return?<br>
<br>
JsonObject new<br>
foo: 1;<br>
respondsTo: #foo:<br>
<br>
Another question is whether it is generally useful or not?<br>
If it's not, you can still have the desired behavior by creating a <br>
subclass. E.g.:<br>
<br>
JsonObject subclass: #PseudoObject<br>
instanceVariableNames: ''<br>
classVariableNames: ''<br>
poolDictionaries: ''<br>
category: 'PseudoObject'<br>
<br>
<br>
PseudoObject >> respondsTo: aSymbol<br>
<br>
^ (super respondsTo: aSymbol)<br>
or: [self includesKey: aSymbol]<br>
<br>
<br>
(Json new<br>
dictionaryClass: PseudoObject;<br>
readFrom: '{"foo": 42}' readStream)<br>
respondsTo: #foo<br>
"==> true"<br>
<br>
<br>
Levente<br>
<br>
><br>
> Best,<br>
> Christoph<br>
><br>
><br>
><br>
> --<br>
> Sent from: <a href="http://forum.world.st/Squeak-Dev-f45488.html" target="_blank">
http://forum.world.st/Squeak-Dev-f45488.html</a><br>
<br>
</div>
</blockquote>
</div>
<br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div><span style="font-size: 10pt;border-collapse: separate">
<div>_,,,^..^,,,_<br>
</div>
<div>best, Eliot</div>
</span></div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>