DIP23 draft: Fixing properties redux
Steven Schveighoffer
schveiguy at yahoo.com
Sun Feb 3 08:09:45 PST 2013
On Sun, 03 Feb 2013 10:56:50 -0500, kenji hara <k.hara.pg at gmail.com> wrote:
> 2013/2/4 Steven Schveighoffer <schveiguy at yahoo.com>
>>
>> ref int foowrap() { return foo;}
>> int *x = &foowrap();
>>
>
> One liner version:
>
> int* x = ((ref x) => &x)(foo);
That looks better than mine, it takes a bit to understand it :) It can be
written into a global function:
T *addressOf(T)(ref T t) {return &t;}
I think this should actually work:
int *x = foo.addressOf;
>> Let's go with the current proposal, and I will address the __traits
>> mechanism separately.
>>
>
> It seems to me that is an overkill.
I have other ideas for such a feature, which map into something I've
wished for a long time. You will see.
-Steve
More information about the Digitalmars-d
mailing list