For these use cases it would be nice to have some sort of syntax sugar
as with the cascade operator, but with a chaining operator instead.

The chaining operator would send the message to the result of the
previous statement instead of the original receiver as in the
semicolon cascade operator (;).

E.g.
dict1 at: 'key1' : at: 'key2' : at: 'key3' .

I selected the colon character in the lack of non-message related characters.

It's only a daydream and nothing that I found very often needing,
except for cases like the mentioned in this thread, extracting a
deeply nested value from a JSON object tree/dictionary.

ps: use the extra parenthesis, they're not that many. :)

Regards!


Esteban A. Maringolo


2017-04-24 14:48 GMT-03:00 Juraj Kubelka <juraj.kube...@icloud.com>:
>
>> On Apr 24, 2017, at 14:42, Markus Böhm <markus.bo...@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
>
>

Reply via email to