Talk:Gotcha (programming)
![]() | This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||||||||||||||
|
![]() | This page has been transwikied to Wiktionary. The article has content that is useful at Wiktionary. Therefore the article can be found at either here or here (logs 1 logs 2.) Note: This means that the article has been copied to the Wiktionary Transwiki namespace for evaluation and formatting. It does not mean that the article is in the Wiktionary main namespace, or that it has been removed from Wikipedia's. Furthermore, the Wiktionarians might delete the article from Wiktionary if they do not find it to be appropriate for the Wiktionary. Removing this tag will usually trigger CopyToWiktionaryBot to re-transwiki the entry. This article should have been removed from Category:Copy to Wiktionary and should not be re-added there. |
The text is from Eric S. Raymonds Jargon File, which is in the public domain. See [1] for details. D.Cutter 15:14, 4 Feb 2005 (CET)
Why I deleted the Transwiki tag
[edit]Gotchas are potentially vast subject and it is extreeeeeemly useful to have a page warning people of some of the common gotchas.Dejvid 11:20, 13 August 2005 (UTC)
Notability
[edit]Googling for programming gotcha yields 619,000 hits. Clearly it's notable, though I'm not sure how to "establish" this in the text. More examples in more languages would help. Perhaps a reference to books on the subject, such as Koenig's C Traps and Pitfalls? Tualha (Talk) 10:04, 26 October 2006 (UTC)
Number of hits in Google does not establish notability. The phrase "purple donkey" yeilds 1,480,000 results. This article should either be broadened to include every kind of gotcha (including those having nothing to do with computers)-- or deleted. Gotcha is a general term. (-XDXFP 4:13PM / Nov 17th)
- Okay. This is clearly a topic that's not confined to be a dicdef. Gotchas as a programming term are well known among programmers. Thus, probably notable (we don't have notability guide for technical concepts, though, but the gut feeling says this is important). If the article was expanded to cover more on the usage, then this would be definitely notable. I'll thus remove the notability tags and tag it for expansion instead. --wwwwolf (barks/growls) 14:39, 1 December 2006 (UTC)
In my opinion this article not notable and could be deleted. Gotcha is a generic term and this article could equally be called "programming pitfalls" or "one line programming errors". Quimn (talk) 00:41, 3 May 2020 (UTC)
Gotchas in the C programing language
[edit]This section is about C programming language but the example code is written in C++. —Preceding unsigned comment added by 83.21.19.168 (talk) 01:19, 27 September 2007 (UTC)
yes and this function parathesis is NOT a gotcha, you just HAVE to know how declarations are working. if you do it 'by eye' then i agree. and == = := is kind of corect 84.16.123.194 (talk) 00:41, 22 January 2008 (UTC)
- #IF 0 up to #ENDIF should be deleted. It's a syntax error. The "gotcha" in the C function example
foo;
is a very good gotcha however - it compiles fine and does nothing of value - it puts the address of the function on the stack, whereafter the address is dropped. ... said: Rursus (mbork³) 17:08, 21 November 2009 (UTC)
Gotchas in Ruby programming language
[edit]Iterating Range
[edit]I don't think this is a gotcha. The example in particular works as expected. A (3..1) Range does not include any element. It's an empty one, since the initial element of the Range is bigger than the final one. Since it's an empty range, iterating over it produces no output, correctly and unsurprisingly.
I think this particular gotcha should be removed.I have removed this gotcha.
- It's still a gotcha because it behaves not the way people expect it to (which would be, iterating backwards: 3,2,1). It may be by design, but it's still a poor design that leads to errors. -- Wesha (talk) 17:58, 9 November 2010 (UTC)
Returns from the block
[edit]As a ruby beginner wannabe, I simply don't understand the example. I think it could be improved by showing where something
has been defined, explaining what the return will actually return from (Boo()
, AFAIU). It is also unclear to me why “the code in transaction() taking care of that will never be executed if something==true
”. Does it means that the code after the return in transaction will not be executed? This is the normal behaviour I would expect.
shtrom (talk) 02:27, 16 May 2010 (UTC)
- Well, what we have between
do
andend
is actually an anonymous, isolated code block, that gets passed as a parameter to functiontransaction()
, and as such one would expect return() to return from that particular block. Function transaction() internally looks like:
def transaction(*params)
# open the transaction...
...
yield # Execute the passed-in block
# close the transaction...
...
end
- The problem is that when you return() inside the block, the remainder of
transaction()
afteryield
will not be executed, i.e. transaction will NOT be properly closed in the DB. -- Wesha (talk) 18:06, 9 November 2010 (UTC)
Relevance of Examples
[edit]Wikipedia is supposed to contain a description of important information relevant to the topic and perhaps a notable example or two simply as illustration. This article is composed almost entirely of examples. Wikipedia simply is not an exhaustive list of every possible thing that may potentially be confusing to a majority of people. I don't think the page should be deleted, but I do think that the entire contents of it should be thrown out and the article re-written. Anyone have any thoughts? Westphjm (talk) 19:45, 1 May 2012 (UTC)
- Belatedly, your advice was acted upon. I deleted the whole unreferenced example farm. A reference to a reliable source must attest that the particular case is a notable "gotcha", i.e., a very common source of programmer's mistake. I can name a dozen of these right out of my head. Such as having items named aValidNameOfATop and aValidNameOfABot and confuse them by cut and paste. Or name a variable 'tmp' and re-use it in two distant pieces of code, and then next coder modifies the code accidentally removing re-initialization of 'tmp'. Or zillion of other sloppiness a compiler will never catch. Staszek Lem (talk) 17:06, 17 August 2015 (UTC)
I agree that this article is not the place for an "example farm", but differ with the rationale, namely that every "particular case" of a notable topic must itself be notable. Certainly concepts such as "person", or many particular species, are notable; but it would be misleading (and sometimes difficult) to limit oneself to notable examples.Sderose (talk) 17:32, 5 December 2017 (UTC)
Not a programming-specific term
[edit]This is just the normal word "gotcha" meaning a trap. I don't see why it deserves a special programming-specific page. Equinox ◑ 20:16, 18 November 2023 (UTC)
Start a discussion about improving the Gotcha (programming) page
Talk pages are where people discuss how to make content on Wikipedia the best that it can be. You can use this page to start a discussion with others about how to improve the "Gotcha (programming)" page.
- Start-Class Computing articles
- Low-importance Computing articles
- All Computing articles
- Start-Class Computer science articles
- Mid-importance Computer science articles
- WikiProject Computer science articles
- Start-Class software articles
- Low-importance software articles
- Start-Class software articles of Low-importance
- Unknown-importance Computing articles
- All Software articles
- Transwikied to Wiktionary