[Issue 15749] New: allow `with` on an expression
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Mar 3 07:51:03 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15749
Issue ID: 15749
Summary: allow `with` on an expression
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: john.loughran.colvin at gmail.com
The motivation is stuff like this:
zip(iota(10), iota(10, 20))
.map!(t => Tuple!(int, "a", int, "b)(t))
.map!(t => with(t) a + b);
which, short of having some proper tuple unpacking syntax (that would be so, so
good), is nicer than the current
.map!((t) { with(t) return a + b; });
that might seem like a small change, but I'm having a hard time selling D and
functional programming to scientists with all the heavyweight syntax, they are
spoiled by the inefficient but neat-looking numpy model.
--
More information about the Digitalmars-d-bugs
mailing list