Re: Problem using hexadecimal [format] on integers
- From: Donald Arseneau <asnd@xxxxxxxxx>
- Date: Mon, 21 Apr 2008 16:23:53 -0700 (PDT)
On Apr 19, 9:17 am, Helmut Giese <hgi...@xxxxxxxxxxxxx> wrote:
seems like [format] needs a special format for wide integers. Try
format %lx [expr 0x5ade3412ab]
[format] has become a complete mess in Tcl today!
With multiple versions of integer representation
(normal, wide, unlimited; varying by platform)
plus automatic conversion between them, the fixed
size format specifiers are a broken relic from the
past. They require knowledge of a value's special
representation, when that is supposed to be hidden.
Unfortunately, in the beginning, [format] was copied
too blindly from C, but it didn't seem so bad in
those days -- the fixed-size implication of %x and %d
could be viewed as an irrelevant curiosity that had
no effect in Tcl. Now that Tcl has various sized of
integers, entirely different from the system in C,
the carry-over of format specifiers is terrible.
It is a painful hangover.
It seems that recently the meaning of the size
specifiers has changed from a requirement to a
conversion request. This may seem better than
getting type-errors in a typeless language, but
has the bad effect of entrenching and legitimizing
the use of these size-specific tags for type-
conversion. Whereas I would like to have the
simplest forms (%x, %d) work, without conversion,
on all sizes of internal integer.
The question is, would it be feasible to change the
meaning of the format specifiers to drop the size
requirement? Another prefix would have to be introduced
to retain the current behavior for conversion to
regular int.
Donald Arseneau asnd@xxxxxxxxx
.
- References:
- Problem using hexadecimal [format] on integers
- From: Erik Leunissen
- Re: Problem using hexadecimal [format] on integers
- From: Helmut Giese
- Problem using hexadecimal [format] on integers
- Prev by Date: Re: How I got rid of those spam posts on c.l.t
- Next by Date: Re: How I got rid of those spam posts on c.l.t
- Previous by thread: Re: Problem using hexadecimal [format] on integers
- Next by thread: Object/ class mixins in XOTcl or TclOO
- Index(es):
Relevant Pages
|