Bug 19287 – each only accepts lambdas that take a single argument

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-10-05T06:55:35Z
Last change time
2024-12-01T16:34:16Z
Assigned to
No Owner
Creator
Nicholas Wilson
Moved to GitHub: phobos#10352 →

Comments

Comment #0 by iamthewilsonator — 2018-10-05T06:55:35Z
See https://forum.dlang.org/post/[email protected] for the motivation. struct that contain destructors cannot be closed over (I'm not sure why but thats a different problem) and so CantCloseMe o; // some struct with a door somerange.each!(e => foo(o,e)); //Error: variable `o` has scoped destruction, cannot build closure fails. But it can't be worked around with somerange.each!((e,f) => foo(o,f))(o); Fails with Error: template somerange.each!((e,f) => foo(o,f)).each cannot deduce function from argument types !()(SomeRange, CantCloseMe), candidates are: ... because all of the each functions take only a range or iterable.
Comment #1 by robert.schadek — 2024-12-01T16:34:16Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10352 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB