[Seaside] Seaside Json serialization for Dictionary, Collection does not recursive jsonOn: aStream ?

Bart Gauquie bart.gauquie at gmail.com
Tue Feb 2 06:26:24 UTC 2010


Hi Nick,

You are right about your change. Its the same kind of issue. I can include
your changes as well.

The only thing dangerous about this is that it can create an endless loop
(the recursive json: calls I mean - also applies to my fixes). But I
consider it the responsibility of the developer to avoid having this. After
all, the resulting Json should also not have loops in it ...

Regards,

Bart


On Mon, Feb 1, 2010 at 10:22 PM, Nick Ager <nick.ager at gmail.com> wrote:

> Hi Bart,
>
>
>> I've also noticed this. There is no implementation of jsonOn: aStream on
>> Object class right now.
>> Your implementation seems like a sensible default thing to do.
>> Its actually highly related to
>> http://code.google.com/p/seaside/issues/detail?id=449 (Generating JSON is
>> difficult) bug.
>>
>
> I've just discovered that the code I posted previously for a default
> implementation of Object>>jsonOn: aStream suffered from a similar problem to
> the one's you've found. Assuming your refactoring the last line should
> read:
>
>     aStream json: attributes
>
>  so the whole code reads:
>
> Object>>jsonOn: aStream
>  | attributes |
> attributes := Dictionary new.
> self class instVarNames do:
>  [ :ivarName |
> attributes
> at: ivarName
> put: (self instVarNamed: ivarName) ].
>  aStream json: attributes
>
> perhaps this could be included with your changes? Comments?
>
> Nick
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


-- 
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere -
Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing
is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert
Einstein
However beautiful the strategy, you should occasionally look at the results.
- Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's
required. - Sir Winston Churchill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100202/3b2a2689/attachment.htm


More information about the seaside mailing list