Re: Variable ontology (was: Q: Pointers in TCl) _________________________________________________________________ From tom_holroyd@yahoo.com Organization Deja News - The Leader in Internet Discussion Date Thu, 02 Apr 1998 23:08:03 -0600 Newsgroups comp.lang.tcl Message-ID <6g1qrj$jna$1@nnrp1.dejanews.com> References 1 2 3 4 5 _________________________________________________________________ In article <35237283.1151@cnet.francetelecom.fr>, Alexandre Ferrieux wrote: > > Cameron Laird wrote: > > Who uses subst? > > confession: I'm eval-intoxicated > > Confession: I'm, too. > > Reason: either you disable one of the three substitutions (\,$,[) and > you violate the symmetrical spirit of the shell, or you do them all at > once, and you are blatantly redundant with 'eval'... Right. Here's an example from a front-end to a graph program that takes statements like label x "data for the first months" where the dates are variables in the app. The label proc does a calc args with: proc calc {argName} { upvar $argName args regsub -all {<([^>]*)>} $args {[calc1 "\1"]} x set args [subst -noback -novar $x] } proc calc1 {x} { regsub -all {([a-zA-Z][a-zA-Z0-9]*)} $x {[getFromApp \1]} y return [expr $y] } So, it just uses command substitution after turning into [calc1 stuff], which is a bit like doing a macro.. -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading