[Issue 5142] writefln should allow no arguments (no formating string)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 2 11:09:07 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5142



--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-11-02 11:08:04 PDT ---
(In reply to comment #2)
> > This was a deliberate change.
> > 
> > The benefit of writeln is that you can put formatting characters in strings
> > without having them interpreted as formatting sequences.
> 
> And how this resolves my problem? I was talking about writefln behaviour, not
> writeln!

writeln is for without formatting, writefln is for with formatting.  writefln
expects its first argument to be a string, if it's not a string, then you
aren't calling it properly.

> 
> > I don't think it's that big of a pain -- the compiler should tell you all the
> > places where you have messed up.
> Yes, it is. Much simpler is just to add empty template writefln() specizliation
> which will just call writeln();, for the sake of consistency, and compatibility
> with old code.

But there is no formatting string.  It's like saying pow(2) should be
equivalent to pow(2, 1).  It makes no sense to call it.  The formatting string
is an essential parameter.

Typing writeln() instead of writefln() is hardly a 'pain', and it's a compile
time error.  Compile time errors are easy to find because the compiler points
them all out for you.  No special searching is necessary.

in fact, here is a special script I wrote in about 5 seconds which will solve
all your problems:

find . -name '*.d' -exec sed 's/writefln()/writeln()/g' {} \;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list