digitalmars.D.bugs - [Issue 1396] New: lazy void tuple breaks
- d-bugmail puremagic.com (22/22) Aug 02 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1396
- d-bugmail puremagic.com (5/5) Aug 02 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1396
- d-bugmail puremagic.com (10/22) Aug 02 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1396
- d-bugmail puremagic.com (25/34) Aug 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1396
- d-bugmail puremagic.com (12/12) Jan 15 2010 http://d.puremagic.com/issues/show_bug.cgi?id=1396
http://d.puremagic.com/issues/show_bug.cgi?id=1396 Summary: lazy void tuple breaks Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: default_357-line yahoo.de import std.stdio; template tuple(T...) { alias T tuple; } void test(lazy tuple!(void, void) a) { a[0](); a[1](); } void main() { test(writefln("Hello"), writefln("World")); } Expected: "Hello\nWorld" Resulted: Error: cannot have parameter of type void. Observed: Seems as if the lazy isn't being applied to all the tuple members as it should be. --downs --
Aug 02 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1396 Added comment: Seems to happen whenever the tuple contains at least one void, for every void in the tuple. --
Aug 02 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1396import std.stdio; template tuple(T...) { alias T tuple; } void test(lazy tuple!(void, void) a) { a[0](); a[1](); } void main() { test(writefln("Hello"), writefln("World")); } Expected: "Hello\nWorld" Resulted: Error: cannot have parameter of type void. Observed: Seems as if the lazy isn't being applied to all the tuple members as it should be. --downsSince 'lazy void' is really shorthand for 'void delegate()' I wouldn't actually have expected 'lazy' to work in this way anyhow... Although it could indeed be useful. Try running it with 'tuple!(lazy void, lazy void) a' and it should work. I consider this an enhancement request, or clarification request, rather than a bug. (It'd be a nice enhancement, though.) --
Aug 02 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1396Since 'lazy void' is really shorthand for 'void delegate()' I wouldn't actually have expected 'lazy' to work in this way anyhow...Works with int. gentoo-pc ~/d $ cat bug.d && echo ---- && gdc bug.d -o bug && ./bug import std.stdio; template tuple(T...) { alias T tuple; } void test(lazy tuple!(int, int) a) { writefln("Eval now"); writefln(a[0], "-", a[1]); } void main() { test({writefln("Hello"); return 1; }(), {writefln("World"); return 2; }()); } ---- Eval now World Hello 1-2Although it could indeed be useful. Try running it with 'tuple!(lazy void, lazy void) a' and it should work. I consider this an enhancement request, or clarification request, rather than a bug. (It'd be a nice enhancement, though.)import std.stdio; template tuple(T...) { alias T tuple; } void test(tuple!(lazy void, lazy void) a) { a[0](); a[1](); } void main() { test(writefln("Hello"), writefln("World")); } gentoo-pc ~/d $ gdc bug.d -o bug bug.d:3: expression expected, not 'lazy' Thanks for the suggestion, though. --downs --
Aug 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1396 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED Fixed DMD1.054. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 15 2010