|
From: Joe E. <jen...@fl...> - 2004-08-30 21:20:36
|
Jeff Hobbs wrote:
> [Joe English]:
> > The new formulation may have a small performance boost in
> > the common case where the -command is a pure list, but
> > it's not fully backwards-compatible, since there are
> > valid script prefixes that aren't lists.
>
> No there aren't.
They're tricky to construct and unlikely to appear in the real world,
but they do exist. Example:
text .left
text .right
set left 1
set cmd {[expr {$left ? ".left" : ".right"}] yview}
uplevel #0 [concat $cmd moveto 0.0]
# ==> works
llength $cmd
# ==> error "list element in braces followed by "]" instead of space"
> The real trick is "script prefix" vs "command prefix". I guess
> for most of Tk it's a script prefix, and that remains that way
> as long as we use uplevel. It really matters at the C level,
> as there we can force it to be one command, vs a script. I'm
> inclined to say "script" just because that's Tk-ish, but I'm
> sure I could be convinced otherwise.
I'm leaning that way also; consistency with "what Tk does"
instead of "what (I think) Tk ought to do".
--Joe English
jen...@fl...
|