Thread overview |
---|
August 02, 2007 [Issue 1396] New: lazy void tuple breaks | ||||
---|---|---|---|---|
| ||||
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 -- |
August 02, 2007 [Issue 1396] lazy void tuple breaks | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1396 ------- Comment #1 from default_357-line@yahoo.de 2007-08-02 15:02 ------- Added comment: Seems to happen whenever the tuple contains at least one void, for every void in the tuple. -- |
August 02, 2007 [Issue 1396] lazy void tuple breaks | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1396 ------- Comment #2 from ibisbasenji@gmail.com 2007-08-02 17:12 ------- (In reply to comment #0) > 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 > Since '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.) -- |
August 04, 2007 [Issue 1396] lazy void tuple breaks | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1396 ------- Comment #3 from default_357-line@yahoo.de 2007-08-03 21:52 ------- (In reply to comment #2) > Since '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-2 > 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.) > 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 -- |
January 15, 2010 [Issue 1396] lazy void tuple breaks | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 --- Comment #4 from Don <clugdbug@yahoo.com.au> 2010-01-15 05:28:50 PST --- Fixed DMD1.054. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation