DIP25 draft available for destruction
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Feb 6 12:02:10 PST 2013
On 2/6/13, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> Probably it'll need a fair amount of tweaking. Anyhow it's in
> destroyable form.
> http://wiki.dlang.org/DIP25
Originally I thought addressOf was only planned for safe functions,
but for system too?
This will likely break almost every library in existence. And
interfacing with C will become severely handicapped.
Btw, using pointers can actually lead to code which is clearer in its intention:
void foo(int* x, int* y) { }
void test(int x, int y)
{
foo(&x, &y); // we know foo might modify these parameters
}
Since we don't have "ref" at the call site, using ref parameters can
lead to code which isn't immediately understood at the call site:
void foo(ref int x, ref int y) { }
void test(int x, int y)
{
foo(x, y); // can the parameters be modified? it's not clear from
the call site
}
Also the DIP argues that addressOf solves the @property issue w.r.t.
return values. I've proposed we use an .addressOf property which only
works on @property functions, and I saw no arguments against it.
More information about the Digitalmars-d
mailing list