Tango quibbles - please write tickets so we can track them

kris foo at bar.com
Sun Sep 16 19:06:34 PDT 2007


Christopher Wright wrote:
> kris wrote:
>> Derek Parnell wrote:
>>> Would is be posible to make Stdout work like this ...
>>>
>>>   Stdout("foo", "{n}", "bar");
>>>
>>> where {n} is the special formatting token whose functionality is the 
>>> same
>>> as .newline.
>>
>> Yes, it would. Except it might perhaps be Stdout.format ("blah{n}"...) ?
> 
> And considering the arrangement of Tango, that would standardize newline 
> formatting a fair bit -- you'd have to add it to 
> tango.text.convert.Layout, so it'd be available everywhere.

Aye

> Looking at the code, it seems that Stdout supports varargs already. 

It always did. Long, long before the first release in January :)

Anyway, FWIW, here's the distinction between those two:

Stdout() is a shortcut, where you just want to dump some output to the 
console. Unlike Stdout.format() it does not support a format-string. 
Instead, it just emits a comma-separated list of the arguments, because 
that's how you type them:

# Stdout (10, "foo", 20) => "10, foo, 20"

It does this via a little lookup table, and there's a limited number of 
patterns supplied.

Stdout.format() is different only in that 'you' supply the formatting 
arrangement.


> Alas, recursion is not used, so only a fixed number of arguments is 
> allowed -- I just tried running it with 26 arguments and got a segfault. 

Ach! Do I detect the scent of a new Ticket? :D




More information about the Digitalmars-d mailing list