Skip to content
Prev 76445 / 398502 Next

tcl/tk return problem

Prof Brian Ripley wrote:
This works, and you weren't suggesting it as a good style, but I'd like 
to say it's really a bad style to write to .GlobalEnv.  The controlled 
use of <<- as in tk_select.list from the file you quoted is really the 
best way to solve this problem.  As a general rule, you shouldn't stomp 
on something you don't own, and functions don't own variables in 
.GlobalEnv.

What tk_select.list does is define OnOK locally, and use <<- to write to
the tk_select.list environment.  Then the result can be manipulated and 
returned politely, without stomping on anything anywhere.

Duncan Murdoch