[squeak-dev] I'd like to contribute to the JSON project

Levente Uzonyi leves at caesar.elte.hu
Mon Nov 9 02:07:38 UTC 2020


Hi Christoph,

On Sun, 8 Nov 2020, Christoph Thiede wrote:

> Hi Levente,
>
> would you mind to merge JSON-ct.41 (#respondsTo:) as well? This would be
> great because I depend on this functionality in another project and
> currently require your JSON fork in my baseline. :-)

I cannot merge it because that would bring back long removed methods, and
MC wouldn't allow me to reject those.
But I can add the changes manually.
If I'm not mistaken, it's just a single method JsonObject >> #respondsTo:.

What is the purpose of that method?
I'm asking because it has got no comment, so I'm not sure its 
implementation is correct.
For example, should

 	JsonObject new respondsTo: #foo:

return false?
What should the following return?

 	JsonObject new
 		foo: 1;
 		respondsTo: #foo:

Another question is whether it is generally useful or not?
If it's not, you can still have the desired behavior by creating a 
subclass. E.g.:

JsonObject subclass: #PseudoObject
 	instanceVariableNames: ''
 	classVariableNames: ''
 	poolDictionaries: ''
 	category: 'PseudoObject'


PseudoObject >> respondsTo: aSymbol

 	^ (super respondsTo: aSymbol)
 		or: [self includesKey: aSymbol]


(Json new
 	dictionaryClass: PseudoObject;
 	readFrom: '{"foo": 42}' readStream)
 	respondsTo: #foo
"==> true"


Levente

>
> Best,
> Christoph
>
>
>
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list