Questions tagged [idioms]

A programming idiom is the usual and customary way to write code in a particular language. Idioms are highly recognizable ways of overcoming a particular limitation and/or writing commonly-used code, sometimes with a purpose that is separate from the literal meaning of the code. An idiom can also be the standard way of implementing something when there are multiple ways to do it.

From Wikipedia:

A programming idiom is a means of expressing a recurring construct in one or more programming languages. Generally speaking, a programming idiom is an expression of a simple task, algorithm, or data structure that is not a built-in feature in the programming language being used, or, conversely, the use of an unusual or notable feature that is built into a programming language.

Something is usually described as being of "idiomatic use" when the construct is common, brief and "comes naturally" to the user of the programming language.

1207 questions
-3
votes
1 answer

Idiomatic way to handle logic error vs programming error in golang

I have been using golang to automate some deploy processes and I had to use exec package to call some bash scripts. I used exec.Command("/home/rodrigo/my-deploy.sh").CombinedOutput() and I saw his implementation func (c *Cmd) CombinedOutput()…
rvillablanca
  • 1,606
  • 3
  • 21
  • 34
-3
votes
2 answers

Representing a value which can't be ctor-initialization-list initialized

I'm writing a class C with a member foo of type foo_t. This member must be defined and valid throughout the liftime of a C instance; however, I don't have the necessary information to construct it at compile time, i.e. I can't use class C { …
einpoklum
  • 118,144
  • 57
  • 340
  • 684
-3
votes
2 answers

How to change the language of the app when THE USER selects the language?

How to change the language of the app when THE USER selects the language? I want to do almost this: http://snowpard-android.blogspot.com.br/2013/03/programmatically-change-language-in.html?google_comment_id=z13isbsazkf3hzea504celo5oy3rjzbyevo0k…
-3
votes
1 answer

What's a simple way to return the first regex match in a string with modern C++?

What is a simple way to return the first part of a string that matches a regex in C++11? Example: For the string "The great brown fox jumped over the lazy dog." and the regexp /g[a-z]+/ the returned match would be "great"
Hirsch Alter
  • 47
  • 1
  • 13
-3
votes
2 answers

How to replace values in one dictionary that are the keys of another?

I have two dictionaries, one that stores country names and another that holds the respective country lat,long coordinates. I'd like to replace the values of path_dict with the values of the matching key in another dictionary. pathcoord_dict =…
-3
votes
3 answers

Does C++ 11 introduce any new ways to break from a nested for loop?

Consider a case of a for inside an other for int f( ... ) { for (int i = start_a; i < end_a; i++) { for (int j = start_b; j < end_b; j++) { // make some computation if( i_must_exit == true) { // exit from all…
Gian Lorenzo Meocci
  • 1,136
  • 2
  • 14
  • 23
-4
votes
1 answer

What is GLOB short for in Unix/Linux/Java world?

The wikipedia page explains what GLOB means. However, it still doesn't say what GLOB is short for. Any explanations?
xmllmx
  • 39,765
  • 26
  • 162
  • 323
1 2 3
80
81