Discussion on Go and D

Manu turkeyman at gmail.com
Sun Apr 8 17:38:15 PDT 2012


On 9 April 2012 03:25, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>wrote:

> On 4/8/12 7:21 PM, Andrej Mitrovic wrote:
>
>> On 4/9/12, Andrei Alexandrescu<SeeWebsiteForEmai**l at erdani.org<SeeWebsiteForEmail at erdani.org>>
>>  wrote:
>>
>>> and pass-by-alias
>>>
>>
>> Speaking of alias, one killer feature would be to enable using alias
>> for expressions. E.g.:
>>
>> struct Window { struct Point { int x, y; } Point point; }
>> void test() {
>>     Window window;
>>     alias window.point.x x;
>>     // use 'x' here which is really window.point.x
>> }
>>
>
> Yah, we should add that at some point. Walter and I discussed about it and
> it's virtually approved. But to be on the conservative side, it's not for
> expressions but for mere pointer-chasing chains.


Why use alias, instead of allowing 'ref' on local declarations?
The alias approach suffers from complications when referencing a complex
expression. Particularly if that expression involves a non-pure function
call. A local ref would seem less problematic to me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120409/4187046b/attachment.html>


More information about the Digitalmars-d mailing list