DMD 2.006 release

Bill Baxter dnewsgroup at billbaxter.com
Tue Oct 16 10:36:08 PDT 2007


Witold Baryluk wrote:
> Dnia Tue, 16 Oct 2007 10:03:26 -0700
> Walter Bright <newshound1 at digitalmars.com> napisał/a:
> 
>> Strings are now invariant. More library overhauls, new library
>> modules. These changes exacerbated problems with const/volatile, so
>> next up is overhauling that.
>>
>> http://www.digitalmars.com/d/changelog.html
>> http://ftp.digitalmars.com/dmd.2.006.zip
> 
> 
> Greate release!
> 
> (And three previous also :D)
> 
> 
> But what is rational reason for this?
> 
> "Breaking change: std.stdio.writef can now only accept a format as its
> first argument."
> 
> const/invariant problems, performance? Or it was too complicated?
> 
> I thing that 
>     writefln("a=%d", a, "b=%.3f", b);
> is more readble than
>     writefln("a=%d b=%d", a, b);
> (in some sense)

I think that's ok still.  It says the *first* argument only.  The first 
argument is a format string in both of your examples.  What you can't do is:

    writefln(a, " is the value of a");

I think the problem is that the implementation of writef et al can't 
tell if you're passing it a literal string format or a variable that 
happens to be a string as the first argument.  This doesn't really seem 
to fix the ambiguity of passing in a string as the first argument, but 
maybe the idea is to get people out of the habit of passing a variable 
as the first arg in general?  Just a guess though.

--bb



More information about the Digitalmars-d-announce mailing list