Hi all,
First of all, despite of being on a non-directly related matter with my question, congrats of Pharo 10.
We (as now we have 2 active Smalltalkers in my country... Yay!)
are creating a civic tech project with Pharo/Lepiter and we would
like to store some Tweet metadata coming from Nitter[1]. As we're
dealing with the differences between the official Twitter API and
the unofficial Nitter one, we put the metadata we need in a
dictionary that has several kinds of objects, from ordered
collections to other dictionaries.
Currently if we serialize a Tweet object in STON, we get this:
Tweet { #created : 'Tue, 05 Apr 2022 12:37:56 GMT', #text : '
[ANN] Pharo 10 Released: pharo.org/news/pharo10-relea���
\n
', #id : '1511322244353597443', #user :
NitterUser { #userName : 'pharoproject', #profileImageUrl : URL [
'http://nitter.42l.fr/pic/pbs.twimg.com/profile_images/541743734/icone-pharo-1_400x400.png'
] }, #metadata : { 'queries' : OrderedCollection [ { 'date' :
DateAndTime [ '2022-04-05T13:36:58.546011-05:00' ], 'parameters' :
'https://nitter.42l.fr/pharoproject' } ], 'timelines' : {
'pharoproject' : '1511048498703126529' } }
}
As you can see, the metadata slot contains a dictionary with
mixed classes of objects. But I read in the ReStore manual[2] (pg
14):
"""
Like other collections, the class of elements for both key and
value can be any other
persistent class, and will be the same for all elements of that
collection (except in the case of
inheritance).
"""
So, is ReStore unable to store metadata dictionaries like the one
described in the previous STON code? if this is possible, how can
I define it in the Tweet class>>reStoreDefinition?
For the moment, I'm going to create a explicit "timelines" slot to store what was being stored at the #timelines key of the metadata dictionary. But, as metadata increases, instead of moving variables previously inside of a dictionary as explicit slots of an object, I think that having a explicit way of storing dictionaries with different kinds of objects, in contrast with only uniform ones, would be needed (but I don't know if this is in the design scope of ReStore).
BTW, Lepiter has allow us to build a pretty fluent interface to
browser Twitter/Nitter profiles and messages. Here it is how such
UI looks for browsing last @pharoproject tweets:
https://i.imgur.com/bxFze1g.png
Any help on how to use ReStore in storing mixed dictionaries is
appreciated.
Thanks,
Offray