digitalmars.D - Programming for std.log
- Jose Armando Garcia (33/36) Feb 12 2012 date with commits to Phobos. I think I have become fairly frustrated
- Adam D. Ruppe (12/14) Feb 12 2012 You do get that if a static assert fails. One of the first
- Jose Armando Garcia (15/29) Feb 12 2012 Very helpful advice! I narrowed it down to:
- Adam D. Ruppe (5/16) Feb 12 2012 It is if you import std.traits. I don't think
- David Nadlinger (4/22) Feb 12 2012 Could be related to the selective import (bug 314) fix, maybe std.format...
- Jose Armando Garcia (7/28) Feb 12 2012 ) is
- David Nadlinger (9/13) Feb 12 2012 So std.log is still/again ready for review?
- Jose Armando Garcia (10/25) Feb 12 2012 Yep! It should be. I am fixing some minor things now. Will do some
- Timon Gehr (2/28) Feb 12 2012 No, it should fail. You forgot to import std.traits.
- Timon Gehr (2/2) Feb 12 2012 Sounds like a candidate for a diagnostics bug report. Back-traces should...
- Paulo Pinto (4/40) Feb 12 2012 Ooch. It looks like C++ template error messages. :(
Hey all,From my experience implementing std.log and trying to keep it up todate with commits to Phobos. I think I have become fairly frustrated with writing D programs and debugging D program compilations (specially templates). I swear that feels like every other commit breaks the std.log module. This is the latest one: std/format.d(782): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (isInputRange!(Range) && Ranges.length1 && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])): bool) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) does not match any function template declaration std/format.d(782): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (isInputRange!(Range) && Ranges.length1 && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])): bool) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) cannot deduce template function from argument types !()(const(char)[],char) How am I suppose to know what is wrong with std.log base on the information above in a 3000 line implementation? I don't even include std.format (as that template could have been instantiated from somewhere else). Having a lot of "experience" trying to solve this kind of problem, I normally remove all my imports and try add the symbols one at a time until I figure out what is wrong. This time I honestly think that I am stumped! I know that this is not a lot of information and I don't expect help resolving this problem but I hint this issues with the following imports: import core.sync.rwmutex: ReadWriteMutex; import std.datetime: SysTime; import std.array: Appender; Is there anyway that dmd can tell me why a template is being instantiated? Something like like: Thanks. Hopefully I'll figure this out sooner rather than later, -Jose
Feb 12 2012
On Sunday, 12 February 2012 at 20:18:13 UTC, Jose Armando Garcia wrote:Is there anyway that dmd can tell me why a template is being instantiated? Something like like:You do get that if a static assert fails. One of the first things I do when I update dmd is to hack up the source to a bunch of phobos to do something like if(!__traits(compiles, instantiation_here)) static assert(0); just because that error message is infinitely more helpful. I don't know about the std.algorithm one, but I do this in std.conv a lot and it is good there because there's a to!() entry point that then calls toImpl, and the to!() one can be easily static asserted.
Feb 12 2012
On Sun, Feb 12, 2012 at 6:25 PM, Adam D. Ruppe <destructionator gmail.com> wrote:On Sunday, 12 February 2012 at 20:18:13 UTC, Jose Armando Garcia wrote:Very helpful advice! I narrowed it down to: $ cat format_spec.d import std.format; void main() { static assert(is(Unqual!char =3D=3D char)); FormatSpec!char spec; } ../dmd/src/dmd -w format_spec.d format_spec.d(4): Error: static assert (is(Unqual!(char) =3D=3D char)) is = false This is suppose to be true, no? Thanks, -JoseIs there anyway that dmd can tell me why a template is being instantiated? Something like like:You do get that if a static assert fails. One of the first things I do when I update dmd is to hack up the source to a bunch of phobos to do something like if(!__traits(compiles, instantiation_here)) =A0static assert(0);just because that error message is infinitely more helpful. I don't know about the std.algorithm one, but I do this in std.conv a lot and it is good there because there's a to!() entry point that then calls toImpl, and the to!() one can be easily static asserted.
Feb 12 2012
On Sunday, 12 February 2012 at 21:43:57 UTC, Jose Armando Garcia wrote:Very helpful advice! I narrowed it down to: $ cat format spec.d import std.format; void main() { static assert(is(Unqual!char == char)); FormatSpec!char spec; } ../dmd/src/dmd -w format spec.d format spec.d(4): Error: static assert (is(Unqual!(char) == char)) is false This is suppose to be true, no?It is if you import std.traits. I don't think the Unqual template is in scope there which is why the is() fails.
Feb 12 2012
On 2/12/12 11:11 PM, Adam D. Ruppe wrote:On Sunday, 12 February 2012 at 21:43:57 UTC, Jose Armando Garcia wrote:Could be related to the selective import (bug 314) fix, maybe std.format is missing an import or a related DMD regression was introduced. DavidVery helpful advice! I narrowed it down to: $ cat format spec.d import std.format; void main() { static assert(is(Unqual!char == char)); FormatSpec!char spec; } ../dmd/src/dmd -w format spec.d format spec.d(4): Error: static assert (is(Unqual!(char) == char)) is false This is suppose to be true, no?It is if you import std.traits. I don't think the Unqual template is in scope there which is why the is() fails.
Feb 12 2012
On Sun, Feb 12, 2012 at 8:11 PM, Adam D. Ruppe <destructionator gmail.com> wrote:On Sunday, 12 February 2012 at 21:43:57 UTC, Jose Armando Garcia wrote:) isVery helpful advice! I narrowed it down to: $ cat format spec.d import std.format; void main() { static assert(is(Unqual!char =3D=3D char)); FormatSpec!char spec; } ../dmd/src/dmd -w format spec.d format spec.d(4): Error: static assert =A0(is(Unqual!(char) =3D=3D char)=Sorry for the false alarm. I think the problem went away once I rebuild dmd, druntime and phobos. Your advice was really good in helping me make any sense of this! Thanks. -Josefalse This is suppose to be true, no?It is if you import std.traits. I don't think the Unqual template is in scope there which is why the is() fails.
Feb 12 2012
On 2/12/12 11:22 PM, Jose Armando Garcia wrote:Sorry for the false alarm. I think the problem went away once I rebuild dmd, druntime and phobos. Your advice was really good in helping me make any sense of this! Thanks. -JoseSo std.log is still/again ready for review? std.log has been in the queue forever (but was previously postponed due to Jose being unavailable), std.uuid is small (but parts of it depend on not-yet-in-Phobos hashing code), and Jacob Carlborg is waiting for feedback on Orange – no clear winner, but to finally get the process running again, I'd suggest to begin the std.log review tomorrow. Since nobody else stepped up, I'd volunteer as review manager. David
Feb 12 2012
On Sun, Feb 12, 2012 at 8:32 PM, David Nadlinger <see klickverbot.at> wrote= :On 2/12/12 11:22 PM, Jose Armando Garcia wrote:Yep! It should be. I am fixing some minor things now. Will do some final testing in Windows. Don't foresee any problems there. I will send you an email in a bit. Either way I think it should be ready for review by tomorrow!Sorry for the false alarm. I think the problem went away once I rebuild dmd, druntime and phobos. Your advice was really good in helping me make any sense of this! Thanks. -JoseSo std.log is still/again ready for review?std.log has been in the queue forever (but was previously postponed due t=oJose being unavailable), std.uuid is small (but parts of it depend on not-yet-in-Phobos hashing code), and Jacob Carlborg is waiting for feedba=ckon Orange =96 no clear winner, but to finally get the process running aga=in,I'd suggest to begin the std.log review tomorrow. Since nobody else stepp=edup, I'd volunteer as review manager. David
Feb 12 2012
On 02/12/2012 10:43 PM, Jose Armando Garcia wrote:On Sun, Feb 12, 2012 at 6:25 PM, Adam D. Ruppe <destructionator gmail.com> wrote:No, it should fail. You forgot to import std.traits.On Sunday, 12 February 2012 at 20:18:13 UTC, Jose Armando Garcia wrote:Very helpful advice! I narrowed it down to: $ cat format_spec.d import std.format; void main() { static assert(is(Unqual!char == char)); FormatSpec!char spec; } ../dmd/src/dmd -w format_spec.d format_spec.d(4): Error: static assert (is(Unqual!(char) == char)) is false This is suppose to be true, no? Thanks, -JoseIs there anyway that dmd can tell me why a template is being instantiated? Something like like:You do get that if a static assert fails. One of the first things I do when I update dmd is to hack up the source to a bunch of phobos to do something like if(!__traits(compiles, instantiation_here)) static assert(0);
Feb 12 2012
Sounds like a candidate for a diagnostics bug report. Back-traces should be available any time a template instantiation fails.
Feb 12 2012
Am 12.02.2012 21:18, schrieb Jose Armando Garcia:Hey all,Ooch. It looks like C++ template error messages. :( -- PauloFrom my experience implementing std.log and trying to keep it up todate with commits to Phobos. I think I have become fairly frustrated with writing D programs and debugging D program compilations (specially templates). I swear that feels like every other commit breaks the std.log module. This is the latest one: std/format.d(782): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (isInputRange!(Range)&& Ranges.length1&& is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])): bool)&& is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) does not match any function template declaration std/format.d(782): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (isInputRange!(Range)&& Ranges.length1&& is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])): bool)&& is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) cannot deduce template function from argument types !()(const(char)[],char) How am I suppose to know what is wrong with std.log base on the information above in a 3000 line implementation? I don't even include std.format (as that template could have been instantiated from somewhere else). Having a lot of "experience" trying to solve this kind of problem, I normally remove all my imports and try add the symbols one at a time until I figure out what is wrong. This time I honestly think that I am stumped! I know that this is not a lot of information and I don't expect help resolving this problem but I hint this issues with the following imports: import core.sync.rwmutex: ReadWriteMutex; import std.datetime: SysTime; import std.array: Appender; Is there anyway that dmd can tell me why a template is being instantiated? Something like like: Thanks. Hopefully I'll figure this out sooner rather than later, -Jose
Feb 12 2012