singleton variable


Also found in: Wikipedia.

singleton variable

(programming)
A variable which is only referred to once in a piece of code, probably because of a programming mistake. To be useful, a variable must be set and read from, in that order. If it is only referred to once then it cannot be both set and read.

There are various exceptions. C-like assignment operators, e.g. "x += y", read and set x and return its new value (they are abbreviations for "x = x+y", etc). A function argument may be passed only for the sake of uniformity or to support future enhancements. A good compiler or a syntax checker like lint should report singleton variables but also allow specific instances to be marked as deliberate by the programmer.
References in periodicals archive ?
The results of genetic diversity indicated that Parsimony informative sites were found to be 11 while Singleton variable sites were not detected.
There were 3 singleton variable sites (at position 177, 198, 222) and 7 Parsimony informative sites at position 64, 135, 143, 174, 187, 197, 199.
An excess of singleton variable sites may be an evidence for population expansion (William et al., 1995).
Analysis of complete mt-DNA D-loop (1214 bp) sequences revealed eight different haplotypes resulting from 32 polymorphic sites (2.63% of all sites), of which 31 sites were singleton variable sites and one site was parsimony informative polymorphic site.