Two standard libraries?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed Aug 1 13:58:02 PDT 2007


Daniel Keep wrote:
> 
> Chris Nicholson-Sauls wrote:
>> renoX wrote:
>> Here's an odd thought: "%{08x:X}"
>> Wherein the {}'s mean, "this is looking at a variable outside", and the
>> ':' means "everything after this point is the variable's name".
>>
>> -- Chris Nicholson-Sauls
> 
> I actually played with something similar for a while, but eventually
> discarded it.  The problem was that there are times when you don't care
> to format some expression, you just want to output the thing.  I didn't
> like that you'd have to carry around the leading ':' when you're not
> using it.
> 
> OTOH, this is pretty similar to what Tango uses in its formatter.  IIRC,
> it's something like {n:f} where ':f' is your optional format string and
> 'n' is the position of the thing you want to format.  Or it might be the
> other way around; I dunno :P
> 
> 	-- Daniel

Tango formatting is '{' [index] [',' alignment] [':' format] '}'

Where alignment is really a minimum width, and the format depends on the 
type you are formatting (the default is "s" as with Phobos' formatting).

Maybe my odd thought would be better as "%{X:08x}" then?  Hmm.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list