Jump to content

Talk:Programming idiom

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ruud Koot (talk | contribs) at 16:44, 30 May 2016 (fmt). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputing Unassessed
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
???This article has not yet received a rating on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.

I'd like to have a category/list of idioms that would include things like Graceful exit, Schwartzian Transform, and so on. I'll have to think about the scope of that first. Joseph N Hall 02:30, 31 August 2006 (UTC)[reply]

Isn't i++ example of Syntactic sugar, and not really a computer language idiom? 80.216.68.41 (talk) 19:05, 25 November 2008 (UTC)[reply]

Parallel looping / traversal of lists or other structures

One idiom that has to be "written by hand" in many languages is to step over the members of two or more lists (or arrays, trees, etc.) at once.

In Lisp, there are idioms using DO or LOOP which explicitly allow you to move through two structures at once. In C, you can do it with comma-separated steps in a for(;;) expression, but it's unusual and considered obfuscated; the idiomatic thing is probably to write it by hand in a while loop. In Python, you use tuple unpacking and zip for lists, but for any other structure you'd probably do it by hand (or maybe use iterators). And in Haskell you'd probably lift the traversal operation for the data structure into the list monad. --FOo (talk) 05:45, 10 December 2009 (UTC)[reply]

Idioms also show up in Data Structures

Programming idioms also show up in data structures. For example, there are particular ways to express graphs using (say) lists and/or maps. -- RichMorin (talk) 00:58, 1 August 2012 (UTC)[reply]

Merge

Some WP:DUP content was trimmed down, but now article looks like a stub. Also, there weren't any sources, so I propose to merge it with bigger topic.

Programming language theory was closets page I was able to find, if there better candidates, I don't mind. Ushkin N (talk) 14:01, 27 May 2016 (UTC)[reply]

These two topics are unrelated and should not be merged. —Ruud 14:07, 27 May 2016 (UTC)[reply]
Then suggest a better parent article. Ushkin N (talk) 14:08, 27 May 2016 (UTC)[reply]
No. It shouldn't be merged at all. —Ruud 14:10, 27 May 2016 (UTC)[reply]

How "Programming idiom" is different from Programming paradigm?

Ushkin N (talk) 14:06, 27 May 2016 (UTC)[reply]

A paradigm comes with a whole collection of idioms. Some idioms, like recursion, are applicable in more than one paradigm. —Ruud 14:08, 27 May 2016 (UTC)[reply]
Yes everyone on the Internet says this. Can you provide sources instead of revert warring please ? WP:EW WP:V WP:TRUTHMATTERS Ushkin N (talk) 14:12, 27 May 2016 (UTC)[reply]
Both Turbak's Design Concepts in Programming Languages and Scott's Programming Language Pragmatics use the term "programming idiom" in a manner where it can't be taken to mean the same as a "programming paradigm". Do you have a source that claims otherwise? —Ruud 14:18, 27 May 2016 (UTC)[reply]
Thank you for references (I haven't checked them yet but I trust your claims).
I think we can expand lead of the Programming paradigm with paragraph about "Programming idiom" as "smaller than programming paradigms".
OR "equivalent" (I don't know exactly yet) Ushkin N (talk) 14:31, 27 May 2016 (UTC)[reply]
This way, Programming idiom will have better context.
Also, with your sources, we can extend list of the sources at Programming paradigm. What do you think? Ushkin N (talk) 14:29, 27 May 2016 (UTC)[reply]
"smaller than programming paradigms" is not correct English in this context. —Ruud 14:38, 27 May 2016 (UTC)[reply]
Agree, then how would you paraphrase this? Ushkin N (talk) 14:42, 27 May 2016 (UTC)[reply]
I'd extend the sentence "... according to the style of computer programming" to "according to the style of computer programming and idioms used". Making it fit in a more natural manner would require a more significant rewrite. —Ruud 14:48, 27 May 2016 (UTC)[reply]
I found some discussion about "Design patterns" vs "Programming idiom"
"Design patterns are not usually language specific. Language idioms tend to depend on particular feature of a language (or class of languages) or work around a specific deficiency in said language(s)." - http://programmers.stackexchange.com/a/106819
Some of the users tend to think this is true. We should mention this WP:POV.
I have no preference where to state this. Ushkin N (talk) 14:54, 27 May 2016 (UTC)[reply]

Programming idiom in "Design Concepts in Programming Languages"

In the version of the book I was able to find, "programming idiom" used 2 without definition what "programming idiom" is.

User:Ruud Koot, can you provide direct reference from "Design Concepts in Programming Languages" where it is defined? Ushkin N (talk) 15:41, 30 May 2016 (UTC)[reply]

Programming idiom in "Programming Language Pragmatics"

In my version of the book:

  • p 169 ... "Consider the programming idiom illustrated in Example 3.22."
  • p 180 ... "The ML type system, for example (Section 7.2.4), avoids the dynamic type checks of Lisp, but disallows certain useful programming idioms that Lisp supports. Similarly, the definite assignment rules of Java and C# (Section 6.1.3) allow the compiler to ensure that a variable is always given a value before it is used in an expression, but disallow certain programs that are legal (and correct) in C."
  • p 265 ... "In functional languages, the ability to specify a function “in line” facilitates a programming idiom in which the body of a loop is written as a function,with the " <...>
  • p 426 ... " The usual programming idiom looks like this:

if (!setjmp(buffer)) { /* protected code */ } else { /* handler */ } "

  • p 560 ... "This programming idiom—an unbounded generator with a test-cut terminator—is known as generate-and-test." ...

Definition of the Programming idiom?

As was stated above, there no source, defining what "programming idiom" is or simply enumerates all "programming idioms" in existence.

Can anyone provide source for Programming idiom? WP:V Ushkin N (talk) 15:54, 30 May 2016 (UTC)[reply]