Re: Why is std.string.format a c-style variadic function?
Ellery Newcomer , dans le message (digitalmars.D.learn:29819), a écrit : On 09/26/2011 11:15 AM, Andrej Mitrovic wrote: On 9/26/11, Ellery Newcomer ellery-newco...@utulsa.edu wrote: std.metastrings.Format wouldn't be what you want, would it? Yep it is, Jonathan mentioned it above. thunderbird hates me. second time I give an answer made redundant by orphaned subthread. I've got the same problem with most of Jonathan's posts. I use flrn, an obsure news reader that nobody here probably knows about, so I thought it was just me. It seems that the Reference field in Jonathan's posts are unusual and break threads in some news reader. Would anyone know a solution (either for Elley and me, or for Jonathan)? -- Christophe
Re: Why is std.string.format a c-style variadic function?
On 27.09.2011 4:43, Ellery Newcomer wrote: On 09/26/2011 11:15 AM, Andrej Mitrovic wrote: On 9/26/11, Ellery Newcomerellery-newco...@utulsa.edu wrote: std.metastrings.Format wouldn't be what you want, would it? Yep it is, Jonathan mentioned it above. thunderbird hates me. second time I give an answer made redundant by orphaned subthread. FWIW I'm on thunderbird, and all is fine here. I'll counter by giving random unsolicited thoughts on Format: don't use it for codegen (or any long format strings, I suppose). dmd chokes on it very quickly. format specifiers could use positional parameters or something. Last summer I actually wrote a Replace template to scratch that itch. dmd choked on it pretty quickly too. -- Dmitry Olshansky
Re: Why is std.string.format a c-style variadic function?
On 2011-09-26 06:47, Jonathan M Davis wrote: On Monday, September 26, 2011 05:39:16 Andrej Mitrovic wrote: I'm only asking because I can't use it inside of a pragma(msg) call since CTFE can't do C-style variadic functions yet. Is `format` defined this way for performance reasons? (to avoid template bloat?) Use std.metastrings.Format. As for std.string.format, I believe that Kenji Hara has been working on improving it. I suspect that it is the way that it is, because it was probably a function in D1, and D1 probably doesn't have variadic templates (I don't use D1 though, so I don't know for sure). - Jonathan M Davis D1 do have variadic templates. -- /Jacob Carlborg
Re: Why is std.string.format a c-style variadic function?
On 9/26/11, Jacob Carlborg d...@me.com wrote: std.string.format is using a D-style variadic parameter list. The compiler disagrees with you: D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\string.d(2432): Error: function std.string.format C-style variadic functions are not yet implemented in CTFE L2432: string format(...) I don't see any other format() overloads in std.string.
Re: Why is std.string.format a c-style variadic function?
On 9/26/11, Jonathan M Davis jmdavisp...@gmx.com wrote: Use std.metastrings.Format. Sweet, I forgot about this one. Thanks.
Re: Why is std.string.format a c-style variadic function?
On Mon, 26 Sep 2011 08:42:09 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 9/26/11, Jacob Carlborg d...@me.com wrote: std.string.format is using a D-style variadic parameter list. The compiler disagrees with you: D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\string.d(2432): Error: function std.string.format C-style variadic functions are not yet implemented in CTFE L2432: string format(...) I don't see any other format() overloads in std.string. That's likely a bug. D variadic functions push the TypeInfo of each parameter onto the stack as well as the parameters themselves. Unfortunately, it's probably just a wrong error message, I doubt D variadic parameters are supported in CTFE. -Steve
Re: Why is std.string.format a c-style variadic function?
On 09/26/2011 07:42 AM, Andrej Mitrovic wrote: On 9/26/11, Jacob Carlborg d...@me.com wrote: std.string.format is using a D-style variadic parameter list. The compiler disagrees with you: D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\string.d(2432): Error: function std.string.format C-style variadic functions are not yet implemented in CTFE L2432: string format(...) I don't see any other format() overloads in std.string. std.metastrings.Format wouldn't be what you want, would it?
Re: Why is std.string.format a c-style variadic function?
On 2011-09-26 17:12, Steven Schveighoffer wrote: On Mon, 26 Sep 2011 08:42:09 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 9/26/11, Jacob Carlborg d...@me.com wrote: std.string.format is using a D-style variadic parameter list. The compiler disagrees with you: D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\string.d(2432): Error: function std.string.format C-style variadic functions are not yet implemented in CTFE L2432: string format(...) I don't see any other format() overloads in std.string. That's likely a bug. D variadic functions push the TypeInfo of each parameter onto the stack as well as the parameters themselves. Unfortunately, it's probably just a wrong error message, I doubt D variadic parameters are supported in CTFE. -Steve Yes, that is not a C-style variadic function. -- /Jacob Carlborg
Re: Why is std.string.format a c-style variadic function?
On 9/26/11, Ellery Newcomer ellery-newco...@utulsa.edu wrote: std.metastrings.Format wouldn't be what you want, would it? Yep it is, Jonathan mentioned it above.
Re: Why is std.string.format a c-style variadic function?
Hmm yea, the docs say so too. Sorry for the noise then. :)
Re: Why is std.string.format a c-style variadic function?
On Monday, September 26, 2011 05:39:16 Andrej Mitrovic wrote: I'm only asking because I can't use it inside of a pragma(msg) call since CTFE can't do C-style variadic functions yet. Is `format` defined this way for performance reasons? (to avoid template bloat?) Use std.metastrings.Format. As for std.string.format, I believe that Kenji Hara has been working on improving it. I suspect that it is the way that it is, because it was probably a function in D1, and D1 probably doesn't have variadic templates (I don't use D1 though, so I don't know for sure). - Jonathan M Davis