Top "Idioms" questions

A programming idiom is the usual and customary way to write code in a particular language.

pimpl for a templated class

I want to use the pimpl idiom to avoid having users of my library need our external dependencies (like boost, …

c++ idioms pimpl-idiom
Idiomatic Ruby filter for nil-or-empty?

I'm looking for a more idiomatic way to filter out nil-or-empty elements of an array. I have many methods of …

ruby idioms enumerable
Properly terminating program. Using exceptions

Question: Is using exceptions the proper way to terminate my program if all I want is to display an error …

c++ exception raii idioms
Idiomatic construction to check whether a collection is ordered

With the intention of learning and further to this question, I've remained curious of the idiomatic alternatives to explicit recursion …

scala recursion fold idioms
What is the idiomatic way to return an error from a function with no result if successful?

In Rust, I believe the idiomatic way to deal with recoverable errors is to use Result. For example this function …

error-handling rust optional idioms rust-result
Idiom(s) for "for each except the last" (or "between each consecutive pair of elements")

Everyone encounters this issue at some point: for(const auto& item : items) { cout << item << separator; } ... …

c++ c++11 idioms separator