Michel Fortin wrote:
On 2009-02-08 22:39:36 -0500, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:
***************
Rule: ref parameters are PASS-DOWN and RETURN only. No escaping of
addresses of ref parameters is allowed. If you want to escape the
address of a ref parameter, use a pointer in the first place.
***************
Isn't the "this" argument for struct a ref now? So you can't do this any
longer:
static A[] listOfRegisteredA;
struct A
{
void register()
{
listOfRegisteredA ~= &this;
}
}
You shouldn't do that anyway as structs can be moved freely.
This rule is powerful and leads to an honest style of programming: if
you plan on escaping some thing's address, you make that clear in the
public signature.
But you can't change the "this" parameter to not be a ref, can you?
It's a ref.
Andrei