DIP25 draft available for destruction
Steven Schveighoffer
schveiguy at yahoo.com
Thu Feb 7 06:43:38 PST 2013
On Thu, 07 Feb 2013 01:06:34 -0500, Walter Bright
<newshound2 at digitalmars.com> wrote:
>
> The only time (now) that you can take the address of function return
> value is if that is a return by ref. So, if taking the address of a ref
> is disallowed, then the syntax is no longer ambiguous.
Thinking about this, I don't know that I like the idea of disallowing
taking the address of ref.
One major usage of taking the address of ref returns is the opIndex
operator:
int *ptr = &arr[0];
Or, more generally, the front property of a range:
int *ptr = &arr.front;
What I am concerned about is that this is not going to have the desired
effect. Instead of grudgingly switching to a new style of coding, people
will simply return pointers instead of ref.
-Steve
More information about the Digitalmars-d
mailing list