[Issue 20071] New: ref locals
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 22 06:58:08 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20071
Issue ID: 20071
Summary: ref locals
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: turkeyman at gmail.com
It's frustrating that we can only use `ref` for function arguments. I should be
able to declare a local variable ref to capture the result of a ref function,
or to simplify a long expression.
ref int fun();
void test()
{
ref int refLocal = fun();
ref int resolveExpression = thing[10].something().member.x;
}
It feels very lame to use pointers in these cases.
It may also change semantics of assignment expressions when using pointers.
--
More information about the Digitalmars-d-bugs
mailing list