digitalmars.D.learn - Tuple to tuple conversion
- Simen kjaeraas (22/22) Jun 07 2010 Sounds stupid, don't it?
- Simen kjaeraas (5/6) Jun 07 2010 Hm, it seems the problem was not where I thought it was. However, this
- Lars T. Kyllingstad (5/25) Jun 07 2010 FWIW, I've run across the same error, while writing code that had nothin...
- Simen kjaeraas (13/16) Jun 08 2010 This has now been tracked down to the importing of std.typecons in two
- Simen kjaeraas (5/20) Jun 08 2010 Forgot to mention, this only happens with -unittest.
- Lars T. Kyllingstad (6/31) Jun 08 2010 That's consistent with my experiences too. It seems to be triggered by ...
- Simen kjaeraas (5/9) Jun 08 2010 2.045. Actually, I can't reproduce it now either. Ah, found the problem.
- Lars T. Kyllingstad (5/14) Jun 08 2010 Ok, now I can reproduce it too, with 2.046. This just makes it even mor...
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (11/12) Jun 23 2010 This may explain a problem that I hit recently.
- Masahiro Nakagawa (4/27) Jun 08 2010 Same issue?
- Lars T. Kyllingstad (4/36) Jun 08 2010 Definitely. Simen's test case is slightly better, though, since it
- Lars T. Kyllingstad (8/27) Jun 08 2010 I'm not sure I understand this. Do you then import a and b into another...
- Simen kjaeraas (4/6) Jun 08 2010 As the bug report says: "dmd -unittest a b"
Sounds stupid, don't it? 123456789012345678901234567890123456789012345678901234567890123456789012 Carrying in my hat my trusty foo, a std.typecons.Tuple!(float), I want to use it as a parameter to a function taking non-tuple parameters, i.e. a single float. foo.tupleof gives me an unwieldy conglomerate of tuple((Tuple!(float))._field_field_0,(Tuple!(float))._0). First, I'm not sure what all of this means, second I'm completely sure it does not mean what I want. foo.field seems much more close to what I want, returning a nice and clean (float) when I ask for it. However, doing so in the context of being a function parameter yields other problems, in the form of: src\phobos\std\typecons.d(424): Error: static assert (is(Tuple!(string,float) == Tuple!(string,float))) is false src\phobos\std\typecons.d(413): instantiated from here: Tuple!(string,float) src\phobos\std\typecons.d(423): instantiated from here: slice!(1,3) problem.d(15): 3 recursive instantiations from here: Tuple!(float) Especially interesting might be line 424, as that assert ought to be true in most cases. I guess what I'm asking for here is, is there a way to do what I want? -- Simen
Jun 07 2010
Simen kjaeraas <simen.kjaras gmail.com> wrote:I guess what I'm asking for here is, is there a way to do what I want?Hm, it seems the problem was not where I thought it was. However, this is getting curiouser and curiouser. -- Simen
Jun 07 2010
On Tue, 08 Jun 2010 03:29:05 +0200, Simen kjaeraas wrote:Sounds stupid, don't it? 123456789012345678901234567890123456789012345678901234567890123456789012 Carrying in my hat my trusty foo, a std.typecons.Tuple!(float), I want to use it as a parameter to a function taking non-tuple parameters, i.e. a single float. foo.tupleof gives me an unwieldy conglomerate of tuple((Tuple!(float))._field_field_0,(Tuple!(float))._0). First, I'm not sure what all of this means, second I'm completely sure it does not mean what I want. foo.field seems much more close to what I want, returning a nice and clean (float) when I ask for it. However, doing so in the context of being a function parameter yields other problems, in the form of: src\phobos\std\typecons.d(424): Error: static assert (is(Tuple!(string,float) == Tuple!(string,float))) is false src\phobos\std\typecons.d(413): instantiated from here: Tuple!(string,float) src\phobos\std\typecons.d(423): instantiated from here: slice!(1,3) problem.d(15): 3 recursive instantiations from here: Tuple!(float)FWIW, I've run across the same error, while writing code that had nothing to do with tuples. And I've seen others complaining about it too. It seems to be a rather elusive bug in Phobos. -Lars
Jun 07 2010
Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:FWIW, I've run across the same error, while writing code that had nothing to do with tuples. And I've seen others complaining about it too. It seems to be a rather elusive bug in Phobos.This has now been tracked down to the importing of std.typecons in two included files. Test case: ////////////////////// module a; import std.typecons; alias Tuple!( float ) foo; ////////////////////// module b; import std.typecons; -- Simen
Jun 08 2010
Simen kjaeraas <simen.kjaras gmail.com> wrote:Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Forgot to mention, this only happens with -unittest. http://d.puremagic.com/issues/show_bug.cgi?id=4294 -- SimenFWIW, I've run across the same error, while writing code that had nothing to do with tuples. And I've seen others complaining about it too. It seems to be a rather elusive bug in Phobos.This has now been tracked down to the importing of std.typecons in two included files. Test case: ////////////////////// module a; import std.typecons; alias Tuple!( float ) foo; ////////////////////// module b; import std.typecons;
Jun 08 2010
On Tue, 08 Jun 2010 12:39:43 +0200, Simen kjaeraas wrote:Simen kjaeraas <simen.kjaras gmail.com> wrote:That's consistent with my experiences too. It seems to be triggered by a Phobos unittest. Still, I can't reproduce it with your test case. Which DMD version are you using? -LarsLars T. Kyllingstad <public kyllingen.nospamnet> wrote:Forgot to mention, this only happens with -unittest. http://d.puremagic.com/issues/show_bug.cgi?id=4294FWIW, I've run across the same error, while writing code that had nothing to do with tuples. And I've seen others complaining about it too. It seems to be a rather elusive bug in Phobos.This has now been tracked down to the importing of std.typecons in two included files. Test case: ////////////////////// module a; import std.typecons; alias Tuple!( float ) foo; ////////////////////// module b; import std.typecons;
Jun 08 2010
Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:That's consistent with my experiences too. It seems to be triggered by a Phobos unittest. Still, I can't reproduce it with your test case. Which DMD version are you using?2.045. Actually, I can't reproduce it now either. Ah, found the problem. "dmd a b -unittest" works. "dmd b a -unittest" does not. -- Simen
Jun 08 2010
On Tue, 08 Jun 2010 12:56:04 +0200, Simen kjaeraas wrote:Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Ok, now I can reproduce it too, with 2.046. This just makes it even more clear that it is a DMD bug, not a Phobos one. I've been running into a lot of these order-of-compilation bugs lately. :( -LarsThat's consistent with my experiences too. It seems to be triggered by a Phobos unittest. Still, I can't reproduce it with your test case. Which DMD version are you using?2.045. Actually, I can't reproduce it now either. Ah, found the problem. "dmd a b -unittest" works. "dmd b a -unittest" does not.
Jun 08 2010
Simen kjaeraas wrote:"dmd a b -unittest" works. "dmd b a -unittest" does not.This may explain a problem that I hit recently. I had had all of a program's code in a single file. Then I started pulling classes to their respective source files one by one. As I did that, of course I compiled and run the application to see that everything still worked. At some point, even though all the unittest blocks were commented out, compiling with -unittest would cause a segmentation fault in the built application. The problem went away as I pulled more classes out of the main source file. Ali
Jun 23 2010
On Tue, 08 Jun 2010 19:39:43 +0900, Simen kjaeraas <simen.kjaras gmail.com> wrote:Simen kjaeraas <simen.kjaras gmail.com> wrote:Same issue? http://d.puremagic.com/issues/show_bug.cgi?id=4003Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Forgot to mention, this only happens with -unittest. http://d.puremagic.com/issues/show_bug.cgi?id=4294FWIW, I've run across the same error, while writing code that had nothing to do with tuples. And I've seen others complaining about it too. It seems to be a rather elusive bug in Phobos.This has now been tracked down to the importing of std.typecons in two included files. Test case: ////////////////////// module a; import std.typecons; alias Tuple!( float ) foo; ////////////////////// module b; import std.typecons;
Jun 08 2010
On Tue, 08 Jun 2010 21:10:54 +0900, Masahiro Nakagawa wrote:On Tue, 08 Jun 2010 19:39:43 +0900, Simen kjaeraas <simen.kjaras gmail.com> wrote:Definitely. Simen's test case is slightly better, though, since it doesn't bring std.stdio into the mix. -LarsSimen kjaeraas <simen.kjaras gmail.com> wrote:Same issue? http://d.puremagic.com/issues/show_bug.cgi?id=4003Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Forgot to mention, this only happens with -unittest. http://d.puremagic.com/issues/show_bug.cgi?id=4294FWIW, I've run across the same error, while writing code that had nothing to do with tuples. And I've seen others complaining about it too. It seems to be a rather elusive bug in Phobos.This has now been tracked down to the importing of std.typecons in two included files. Test case: ////////////////////// module a; import std.typecons; alias Tuple!( float ) foo; ////////////////////// module b; import std.typecons;
Jun 08 2010
On Tue, 08 Jun 2010 12:31:50 +0200, Simen kjaeraas wrote:Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:I'm not sure I understand this. Do you then import a and b into another module to reproduce the error? This doesn't do it for me... Anyway, I was wrong calling this a Phobos bug. It's clearly a DMD bug, since the error message static assert (is(Tuple!(string,float) == Tuple!(string,float))) is false is completely meaningless.FWIW, I've run across the same error, while writing code that had nothing to do with tuples. And I've seen others complaining about it too. It seems to be a rather elusive bug in Phobos.This has now been tracked down to the importing of std.typecons in two included files. Test case: ////////////////////// module a; import std.typecons; alias Tuple!( float ) foo; ////////////////////// module b; import std.typecons;
Jun 08 2010
Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:I'm not sure I understand this. Do you then import a and b into another module to reproduce the error? This doesn't do it for me...As the bug report says: "dmd -unittest a b" -- Simen
Jun 08 2010