All the answers have been good. I am somewhat provoked (in the good sense of forcing me to think) by Siemen who sort of think of it as a code-smell. Best, Kasper
On 26 Feb 2022, at 17.14, Siemen Baader <siemenbaader@gmail.com> wrote:
Hi Kasper,
perhaps not what you are asking, but I find that this kind of nesting happens to me when parsing serialized data (web page sources or JSON as in your example). For me, the root cause of the problem is that these data structures are not represented by real classes in my code. I often start with what you are showing in a Playground, but then refactor it into specific parsers for the web sites I am scraping. The parsing selectors go into classes that mirror the parts of the data I am interested in. I find this to be more declarative and maintainable, and more natural in the Pharo environment with its browsers and code extractors.
I hope this is of any use :)