Stef,
On 12 Aug 2014, at 07:55, stepharo <
[hidden email]> wrote:
> sven
>
> I was wondering if we could get the following in STON
>
>
> STON acceptNonPresentClasses.
>
> STON readFrom: 'Blblbl {#foo : 3}
>
> would create a dictionary with class name -> #Blblbl
>
> Now if the class is loaded we would get a Blblbl object
Good idea:
===
Name: STON-Core-SvenVanCaekenberghe.51
Author: SvenVanCaekenberghe
Time: 12 August 2014, 3:40:21.574545 pm
UUID: 6559f648-b74a-4901-b249-e72808fdea0d
Ancestors: STON-Core-SvenVanCaekenberghe.49
Add STONReader>#acceptUnknownClasses: option
When true (default is false) an unknown object class will result in a map with an added property #className (thx Stéphane Ducasse for the suggetion)
Added STON class>>#classNameKey
Moved #stonName from Class to Object class
Added STONReaderTests>>#testUnknownClasses
===
Name: STON-Tests-SvenVanCaekenberghe.46
Author: SvenVanCaekenberghe
Time: 12 August 2014, 3:40:43.256364 pm
UUID: e48a3d7c-6d8a-4899-943f-829ee4e8715d
Ancestors: STON-Tests-SvenVanCaekenberghe.44
Add STONReader>#acceptUnknownClasses: option
When true (default is false) an unknown object class will result in a map with an added property #className (thx Stéphane Ducasse for the suggetion)
Added STON class>>#classNameKey
Moved #stonName from Class to Object class
Added STONReaderTests>>#testUnknownClasses
===
> Christophe has some other ideas such
>
> STON nilOutEmptyCollections.
> to avoid to save #() and other
I think this can better be done with a custom serialisation, assuming #roles is a lazy initialised collection, like:
#stonOn: stonWriter
stonWriter writeObject: self streamMap: [ :stream |
stream
at: #username put: username;
at: #password put: password.
(roles isNil or: [ roles isEmpty ])
ifFalse: [ stream at: #roles put: roles ] ]
BTW, not writing nil is already an option, see #stonShouldWriteNilInstVars
> Stef
Thanks for the feedback,
Sven