digitalmars.D.bugs - [Issue 12872] New: Feature request: Allow ref in arguments at the
- via Digitalmars-d-bugs (33/33) Jun 06 2014 https://issues.dlang.org/show_bug.cgi?id=12872
https://issues.dlang.org/show_bug.cgi?id=12872 Issue ID: 12872 Summary: Feature request: Allow ref in arguments at the callsite Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: eco gnuk.net It'd be nice to be able to do this... void foo(ref int a) { a += 1; } void main() { int a; foo(ref a) // <---- callsite ref } ...to show that a reference is being taken during that call and that the value may change within the function call. I think it would also be nice if you could require the callsite ref using a compiler switch and that it would eventually be on by default (I suspect this is far more controversial though and should be considered a separate request from just allowing the "ref" in the call). The same extends to "out". "in" could be added too but I don't see much value in that. --
Jun 06 2014