(I show this here because it's probably a silly idea, but it may a chance to 
learn something.)
Do you like the idea of a POD that is always managed by reference, as class 
instances?


ref struct Foo {}
static assert(Foo.sizeof == 1);
void main() {
    Foo f1; // void reference
    Foo f2 = new Foo; // by reference
}


It is as light as a struct, but you don't need to use the pointer syntax to 
manage a Foo instance, the code is cleaner. There is no info field inside a ref 
struct, so in some situations the destructor doesn't get called, like regular 
structs.

Bye,
bearophile

Reply via email to