2017-06-30 8:28 GMT-03:00 Norbert Hartl <norbert@hartl.name>:
Am 30.06.2017 um 12:03 schrieb Stephane Ducasse <stepharo.self@gmail.com>:
recently I started to read a book on machine learning and they manipulate dictionary of dictionary. (So I started my own implementation and I will switch to DataFrame).
having an abstract notation for a structure (or dictionary of dictionary) is something really useful. I work a lot with JSON and the creation in pharo is done the same way but you have to call asDictionary all the time which is annoying. This can be rethought and would make things less ugly if we had a good way. If it is close to S-expressions the better.
I don't what black magic requires, but having a syntax compatible with JSON would be a HUGE boost. Maybe because of where the keys are located on my keyboard layout, but the #-> selector, although I understand its semantics, it's cumbersome to type. I'd love a more compact representation. If the compiler could be modified to accept $: as a message selector, then we could map it to return an Association as #-> currently does. I can't foresee the implications of such change.
What I don't like about it is that the object literal exposes the internal implementation of the object. Everything is based on index. So it could suffer the same problem as fuel. When you don't have the exact same code the deserialization fails. As a dictionary is both, an array of associations and a key-value store, it works perfectly there. But for other objects I have doubts. Especially is in a lot of contexts you need to have a mapping of internal state to external representation. It can be applied afterwards but I'm not sure that can work all the time.
One of the stregths of the JSON format is it doesn't matter in which order the data arrives, otherwise you'd use a Array, because you already know the indices of the data you're looking for. Regards! -- Esteban.