Maybe we could introduce `@` message, so one can chain them and then even execute keyword without parenthesis Dictionary>>@ aKey ^ at: aKey dict @ 'key1' @ 'key2' @ 'key3' dict @ 'key1' @ 'key2' @ 'key3' select: [ :each | ... ] I'm always adding this when hacking around, maybe we could have it in Pharo. Peter On Mon, Apr 24, 2017 at 02:48:48PM -0300, Juraj Kubelka wrote:
On Apr 24, 2017, at 14:42, Markus Böhm <markus.boehm@gmail.com> wrote:
May I ask: What's the idiomatic way to retrieve values from nested dictionaries?
(((dict1 at: 'key1') at: 'key2') at: 'key3')
Are all the brackets really necessary?
I think so, without the parenthesis, it is interpreted as one message at:at:at:
If you use it a lot, you may want to convert the dictionary structure into domain objects.
Juraj
BR Mike