3 ms·
Idioms are always language-specific. The word idiom essentially means "a peculiarity of language" or "a phrasing that wouldn't work elsewhere." But we're being
by Retra 12y ago
Idioms are always language-specific. The word idiom essentially means "a peculiarity of language" or "a phrasing that wouldn't work elsewhere." But we're being vague here anyway, because 'pattern' is a vague word. Everything is a pattern. Data structures are a structured pattern of data.
Whether you choose to implement something as an array or as a hash table is a "design pattern": a pattern invoked by a designer to solve a problem. You don't have to use a singleton pattern or a visitor pattern. You choose to as a consideration of your design. But you shouldn't have to roll your own code to make that design work, because we have a name for it and we know what you're talking about. It should be in a library or in the language. (Which, in my opinion, is a farcical distinction: languages and libraries should always be considered together at all levels, including in language design.)