D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15749 - allow `with` on an expression
Summary: allow `with` on an expression
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: industry, pull
Depends on:
Blocks:
 
Reported: 2016-03-03 15:51 UTC by John Colvin
Modified: 2024-12-13 18:47 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description John Colvin 2016-03-03 15:51:03 UTC
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.
Comment 1 Dlang Bot 2022-03-07 07:21:37 UTC
@maxhaton created dlang/dmd pull request #13776 "Fix Issue 15749 - Implement with expressions" fixing this issue:

- Fix Issue 15749 - Implement with expressions

https://github.com/dlang/dmd/pull/13776
Comment 2 dlangBugzillaToGithub 2024-12-13 18:47:04 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19104

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB