Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 19, 2011 [Issue 5753] New: Disallow map() of void function | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5753 Summary: Disallow map() of void function Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2011-03-19 07:11:03 PDT --- This code compiles with no errors (DMD 2.052), but in my opinion it has to raise a compile-time error, because map() must statically refuse functions that return void: import std.algorithm; void foo() {} void main() { int[] data = [1, 2, 3]; map!((int i){ return foo(); })(data); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 19, 2011 [Issue 5753] Disallow map() of void function | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5753 --- Comment #1 from bearophile_hugs@eml.cc 2011-03-19 07:12:24 PDT --- A simpler example: import std.algorithm; void foo(int x) {} void main() { int[] data = [1, 2, 3]; map!foo(data); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 24, 2011 [Issue 5753] Disallow map() of void function | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5753 Pedro Rodrigues <pdfrodrigues@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pdfrodrigues@gmail.com --- Comment #2 from Pedro Rodrigues <pdfrodrigues@gmail.com> 2011-04-24 12:17:15 PDT --- I propose the following fix for this issue https://github.com/pdfr/phobos/commit/67ff377318e7d392115d4565a8043f4a347a3c13 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 24, 2011 [Issue 5753] Disallow map() of void function | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5753 --- Comment #4 from bearophile_hugs@eml.cc 2011-04-24 12:43:54 PDT --- For Phobos devs: see also the comment about mixing up lazy evaluation with side effects: http://d.puremagic.com/issues/show_bug.cgi?id=5804#c2 -- 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