Namespace:

int counter;

void foo(scope int a) {
    counter = a;
}

void main() {
    int num = 42;
    foo(num);
}

works fine but I think it should not. So can you explain me the use of scope as a storage class?

Generally such enforcement is not (well) implemented in the dmd front-end still. And I think it's mostly meant for reference types (class references and raw pointers), so even when it's implemented I think it will not give an error in your case.

Bye,
bearophile

Reply via email to