Re: 8.5 beta and decimal precision handling
- From: Alexandre Ferrieux <alexandre.ferrieux@xxxxxxxxx>
- Date: Fri, 28 Sep 2007 20:40:46 -0000
On Sep 28, 3:15 pm, keithv <kvet...@xxxxxxxxx> wrote:
On Sep 28, 3:24 am, Arjen Markus <arjen.mar...@xxxxxxxxxx> wrote:
There are very good reasons for the change (shimmering
can no longer influence the value), but as Michael
suggests, to mitigate the above effect, you should
use [format] (and perhaps traces).
Yuck, that seems like a step backwards.
Aren't you basically saying that -textvariable is useless
for real number fields? (Once you've got the trace, just
config the widget instead of using a shadow variable.)
Yes. So what ? GUI is about displaying *strings*, especially human-
readable, short ones, while floating-point values don't have an
automagic mapping to them. Human, dedicated coding is required to
decide that here you need [format %.2f] and there %.9f.
As to using traces to make the migration painless (a write trace
calling [.w configure -text [format %.2f $x]]), I'd say yes, but
beware of making the bridge too inconspicuous: the trace is all right
as long as the var is updated just once at the end of the computation;
but if someday another person comes in unawares, he may use the output
variable in the core of a computation (like an accumulator), and the
trace will hit performance badly.
Personally, in 10+ years of tcl programming, I've never
encountered the problem tip 132 is fixing, but now in just
one of my applications I have over 100 widgets I must hack up.
Depends on one's perspective. You're more of a GUI guy, fine. But
please let others be concerned about the semantics of basic types, and
wince at no less than breaking the EIAS assumption. Moreover, if you
have over 100 widgets displaying floats with -textvariable with not
the slightest hint of factoring between them, well ... maybe TIP 132
was a healthy move in at least two ways ;-)
-Alex
.
- References:
- 8.5 beta and decimal precision handling
- From: keithv
- Re: 8.5 beta and decimal precision handling
- From: Arjen Markus
- Re: 8.5 beta and decimal precision handling
- From: keithv
- 8.5 beta and decimal precision handling
- Prev by Date: Re: Simple parser for C/C++
- Next by Date: Re: OT: load distribution algorithm
- Previous by thread: Re: 8.5 beta and decimal precision handling
- Next by thread: The 14th Annual Conference
- Index(es):