www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - printf. Must. Die.

reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
OK, not really perish - just move back to std.c.stdio ?


Having it "implicitly" defined in object.d only:

1) Promotes old bad D coding behaviour
    ("forgetting" to import std.c.stdio)
2) Makes moving to writef seem harder
    (since you have to import std.stdio)
3) Adds bloat to the std/Phobos library
    (by linking in the floating-point stuff)

Might as well remove the print() methods, as well...
Perhaps even move all of Phobos over to using writef ?


It should *definitely* be out before any "D 1.0" release.

--anders


PS. It's used all over the place:

     http://www.digitalmars.com/d/overview.html
     http://www.digitalmars.com/d/wc.html
     http://www.digitalmars.com/d/sdwest/index.html

     object.printf: "Die! Die! Die!"

     digitalmars.D.bugs/255
     digitalmars.D.bugs/3170
     digitalmars.D.bugs/3438
Dec 14 2005
next sibling parent Don Clugston <dac nospam.com.au> writes:
Anders F Björklund wrote:
 OK, not really perish - just move back to std.c.stdio ?
 
 
 Having it "implicitly" defined in object.d only:
 
 1) Promotes old bad D coding behaviour
    ("forgetting" to import std.c.stdio)
 2) Makes moving to writef seem harder
    (since you have to import std.stdio)
 3) Adds bloat to the std/Phobos library
    (by linking in the floating-point stuff)
 
 Might as well remove the print() methods, as well...
 Perhaps even move all of Phobos over to using writef ?

It seems to be mostly used in unit tests. I think we really need some way of importing stdio only during unit tests. Since you can do debug import std.stdio; how about something like: unittest import std.stdio; or allow: unittest { import std.stdio; } or at the very least, define version UnitTest so that you can write: version(UnitTest) { import std.stdio; } It is common for unit tests to have dependencies which are different from the rest of the module. In any case, I agree that this should be a 1.0 feature removal.
Dec 14 2005
prev sibling parent clayasaurus <clayasaurus gmail.com> writes:
Anders F Björklund wrote:
 PS. It's used all over the place:
 
     http://www.digitalmars.com/d/overview.html
     http://www.digitalmars.com/d/wc.html
     http://www.digitalmars.com/d/sdwest/index.html

Also used here http://www.digitalmars.com/d/code_coverage.html
Dec 17 2005