SINGLETON VARIABLE
\sˈɪŋɡə͡ltən vˈe͡əɹɪəbə͡l], \sˈɪŋɡəltən vˈeəɹɪəbəl], \s_ˈɪ_ŋ_ɡ_əl_t_ə_n v_ˈeə_ɹ_ɪ__ə_b_əl]\
Sort: Oldest first
-
A variable which is only referred to once in apiece of code, probably because of a programming mistake. Tobe useful, a variable must be set and read from, in thatorder. If it is only referred to once then it cannot be bothset and read.There are various exceptions. C-like assignmentoperators, e.g. "x += y", read and set x and return its newvalue (they are abbreviations for "x = x+y", etc). Afunction argument may be passed only for the sake ofuniformity or to support future enhancements. A goodcompiler or a syntax checker like lint should reportsingleton variables but also allow specific instances to bemarked as deliberate by the programmer.
By Denis Howe