"Proposal" for global/local parameter scope in CASA Version umpteenth+1 (2008-04-23) S.T. Myers ******************************************************************* See discussion on the wiki for more on A,B,C: https://wikio.nrao.edu/bin/view/Software/CasaVariableScope Previous proposals: http://www.aoc.nrao.edu/~smyers/naug/notes/2008-04-21-myers-globals.txt and http://www.aoc.nrao.edu/~smyers/naug/notes/2008-04-22-myers-globals.txt (Part A only) NOTE: the discussion is about tasks, toolkit useage is unaffected, and the "meta-tasks" like go, inp, tget (which use the "taskname" global) also have to work independent of scope etc. This is essentially David Whysong's proposal. ------------------------------------------------------------------- Remove casaglobals param. Tasks invoked with "go" ALWAYS use the current global parameter values except for those specified as args. Tasks invoked as > go task(var1=val1) will use the globals except for the vars listed as args, AND the global values for input parameters are NOT changed by tasks. NOTE: output variables as parameters will need to be always set in the task and are thus "global" and changed in the task. Tasks invoked as calls with arguments NEVER use the current global parameter values, but use defaults except for those given as explicit args: > task (var1=val1, etc.) Note that upon successful completion the actual parameters specified in the call will be in the .last file and thus accessible via tget. But the current value of the globals will NOT be updated to these just by running the task. An exception is a task called without args, e.g. > task > task() These would fail if defaults were used because no task will actually run on the defaults (they at least need some dataset to work on). A task call like these with NO specified arguments will therefore be treated as > go task and uses the current globals. Note that this will alleviate most of the breakage of current examples and regressions. Pros: reasonably simple and clean, no toggles, easy to explain makes scripts using call style straightforward and deterministic fulfills ALMA req OL-2.4-R4 and EVLA R2.4-R2.2 is expected behavior for most users used to python or function calls (miriad?) most current users used to doing "go" or just "task()" so will not see change gets rid of the "casaglobals" parameter straightforward to put into effect in tasks only a few changes needed to docs Cons: two different behaviors depending on how called a few changes needed in cookbook and other docs is NOT expected behavior for difmap users breaks previous behavior to mix setting params and then doing task(var1=val1) to change that one only subtle distinction between "go task(var1=val1)" and "task(var1=val1)" will need to make the distinction clear to users in documentation