logoalt Hacker News

fookertoday at 7:20 PM1 replyview on HN

> So you would be equally critical of overloading [] for maps?

No, I'm not sure how you got that impression. Overloading is great.

It's also confusing when it does something completely different from what you intuitively expect.


Replies

BeetleBtoday at 8:32 PM

If you're an old timer, you expect [] to index into an array, and you definitely do not expect it to do a lookup in a map/dict. Older languages just didn't include a dict-like structure in the language (technically, even C++ didn't).

Do you not see that for them, overloading [] for dictionary lookups is "something completely different from what you intuitively expect"?

show 1 reply