but I believe it would be better to let the (D) compiler optimization stage figure out _automatically_ if it needs to make a copy of the variable `numbers` or not depending on whether `numbers` is used or not further down the body of `main`.

I just realized that solving this in an elegant way (for reference types) would require some kind of new builtin property, say,

    r.isUnique

The compiler could, when possible, do this check at compile-time, and avoid any run-time (GC) or reference counting overheads done in isUnique.

I just found that this is highly related: http://wiki.dlang.org/DIP29

Reply via email to