|
From: <pl...@pi...> - 2012-05-03 22:22:42
|
On 05/03/12 08:37, Tait wrote: >> So yes, there is an inconsistency. There are currently three "for" >> constructs >> do for >> set for >> plot for >> >> The first two of these always iterate at least once; the third one does not. >> The documentation is silent on the intended behavior. >> So which to change, "plot for" or both the others? > > Given that it's called "for" I'd say the principle of least surprise > dictate that it act consistently with "for" as used in most programming > languages (e.g. C). > The illogical and inconsistent result of always executing once means that any situation where this is programmed to use variable values necessitates an additional test as the first thing within the 'for' structure, for it to be able to produce predictable output. Since these syntactical tweaks to gnuplot commands do not allow complex, structured content, it would seem best to provide a behaviour which produces consistent behaviour irrespective of variable values, avoiding the need for further tests. ie for (i=2 ; i<=1) does nothing. Clearly it needs to be the same and thoroghly documented in all contexts. Peter. |