[squeak-dev] JSON in SCouchDB

Igor Stasenko siguctua at gmail.com
Sun Jun 20 16:51:00 UTC 2010


On 20 June 2010 19:27, Tim Felgentreff <tim at nada1.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Subclassing the Dictionary directly just didn't work on gnu smalltalk (for reasons have yet been unable to determine) - calling new on any subclass of Dictionary will throw an error.

Oh.. i see. Bad luck. File the bug report to GNU St developers :)

>
> I once had similar problems subclassing other collection classes and was told by a Squeaker that it's "better" to delegate to collections instead of subclassing them in the domain anyway. If you don't agree, feel free to ignore the changes relating to JsonObject class and I will move them to the Gnu Smalltalk diff.
>

Not in case of JsonObject , because it is naturally a dictionary of
key/value pairs, so there are a little
need for delegation.
So, by subclassing it, i eliminated an additional message sends for
better performance as well as
it gives a full Collection/Dictionary protocol available to operate
with json objects.
Originally, a JSON library was also used a delegation.

I'd like to forward this exchange to squeak-dev list, lets hear what
others thinking.
I am also would like to see this stuff portable, without the need of
external patches, even
if it means some sacrifices (i hope not much) :)

> On Jun 20, 2010, at 6:18 PM, Igor Stasenko wrote:
>
>> Tim, what is motivation to delegate json object to dictionary instead
>> of subclassing it?
>>
>> On 20 June 2010 19:12, Igor Stasenko <siguctua at gmail.com> wrote:
>>> Thank you.
>>> I will review them carefully.
>>>
>>> On 20 June 2010 15:23, Tim Felgentreff <tim at nada1.de> wrote:
>>>> Hi
>>>> I'm attempting to port your JSON/SCouchDB code to Gnu Smalltalk. I'm using a separate git branch to keep track of the Gnu Smalltalk specific diffs, however, I though it would be a good idea to keep the Squeak codebase as portable as possible. I'm attaching a mcz with changes I did in Squeak which don't break the tests for either JSON or SCouchDB, but make it more portable for GST.
>>>> I though I'd send them to you for review and possibly inclusion in the main repository on Squeaksource.
>>>>
>>>> Regards,
>>>> Tim
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (Darwin)
>
> iEYEARECAAYFAkweQW4ACgkQLbWJItnd6CxXkACgwA59l35Z2/KjO6JIWq/iRrp0
> Z0cAniAdefgAo27A9pie7j2il/tdAHij
> =R55q
> -----END PGP SIGNATURE-----
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list