dmd 2.029 release

Nick Sabalausky a at a.a
Mon Apr 27 11:31:16 PDT 2009


"renoX" <renosky at free.fr> wrote in message news:49F56A74.4000606 at free.fr...
> Nick Sabalausky a écrit :
>> "bearophile" <bearophileHUGS at lycos.com> wrote in message 
>> news:gsipn1$1bng$1 at digitalmars.com...
>>> Andrei Alexandrescu:
>>>> If it were an error, I wouldn't let it go.
>>> It's an error. It will lead to troubles.
>>>
>>
>> Sometimes it is an error, but there are times when it isn't:
> [cut]
>> Call List In Psuedo-Japanese:
>> For Each Person Where Name="Smith": "SmithSan {LoopIndex}'s DenwaBango: 
>> {Phone}"
>> ---------------------
>>
>> So then the report creation code:
>>
>> ---------------------
>> foreach(int i, Person p; people.subset(customReport.whereClause))
>>     writefln(customReport.formatStr, i, p.id, p.first, p.last, p.phone, 
>> p.zip);
>> ---------------------
>>
>> That would be very difficult/limiting if every arg had to be used in the 
>> format string.
>
> Mmmh, is {LoopIndex} correct? It should be {i} I think and I would argue 
> that this format string should generate an error (something better than a 
> runtime exception would be nice but I'm not sure that this is possible).
>

That was just for illustrative purposes.

>
>> (Incidentally, this example also demonstrates why I consider 
>> C#/Tango-style string formatting superior to C/Phobos-style)
>
> I think that named format string are much superior to positional format 
> string as they are easier to read/write..
>

Actually, I was referring to the ability to specify them out-of-order, 
repeat them, etc. (I didn't realize that Phobos's writef had recently gained 
that ability). To my knowledge, C#/Tango string formatting don't actually 
support named strings, only numerical ones. I was just using names for 
illustrative purposes, and (unclearly) implying that the app would translate 
those named formats into numerical ones before passing them along to the 
string output function.




More information about the Digitalmars-d-announce mailing list