On Monday, 2 March 2015 at 20:54:20 UTC, Walter Bright wrote:
On 3/2/2015 12:42 PM, Walter Bright wrote:
For D structs, that means, if there's a postblit, a copy must be made. For D ref counted classes, a ref count increment must be done.

I was hoping to avoid that, but apparently there's no way.

There are cases where this can be avoided, like calling pure functions. Another win for pure functions!

It seems like the most common use case for passing a global to a parameter is to process that global in a pure way. You already have access to it in an impure function, so you could just access it directly. The good news is that from within the passed-to function, no further calls will treat it as global.

Reply via email to