On 9 April 2012 03:25, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> wrote:
On 4/8/12 7:21 PM, Andrej Mitrovic wrote:
On 4/9/12, Andrei Alexandrescu<SeeWebsiteForEmail@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?