Discussion on Go and D
Jacob Carlborg
doob at me.com
Mon Apr 9 02:25:25 PDT 2012
On 2012-04-09 02:21, Andrej Mitrovic wrote:
> On 4/9/12, Andrei Alexandrescu<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
> }
>
> It makes it simpler to manipulate nested structs and their fields by
> reference without involving pointers or using with statements. AFAIK
> C++ can use references for this purpose (ala&int x =
> window.point.x;), but I guess this isn't very efficient unless the
> compiler can optimize it.
>
> Besides myself I've also seen other people request it (I think Nick S.
> wanted the feature).
I want this feature as well. I also want it to be possible to document.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list