On Saturday, 17 December 2011 at 20:01:04 UTC, Jakob Ovrum wrote:
The docs for onReceiveHeader,

http://freeze.steamwinter.com/D/web/phobos/etc_curl.html#onReceiveHeader

explicitly says that the const string parameters are not valid after the function returns. This is all well and good; but a minor improvement would be to change the signature to:

@property void onReceiveHeader(void delegate(in char[] key, in char[] value) callback);

to add `scope` to the parameters. This documents the fact that the constant strings shouldn't be escaped as-is in both code and documentation. I suspect many other instances of `const(char)[]` could be changed to `in char[]` to better document how they use the parameters (I also personally think it looks better as it is more concise).

I agree. Actually I thought that 'in' was just an alias of 'const' but now I see that it is actually an alias of 'const scope'.


Reply via email to