DConf 2013 Day 1 Talk 2: Copy and Move Semantics in D by Ali Cehreli

Jonathan M Davis jmdavisProg at gmx.com
Thu May 16 11:51:39 PDT 2013


On Thursday, May 16, 2013 11:13:27 Regan Heath wrote:
> So, I think in cases where the function/method doesn't need to retain the
> argument for longer than the lifetime of the call it should accept
> const(char), otherwise as you mentioned earlier it's better to simply
> require the caller provide the immutable(char) you require.

Well, as I said, the decision depends on what you're doing with the string. If 
you're just operating on it and not storing it or duping it, then
const(char)[] or inout(char)[] makes the most sense, whereas if you're storing 
it or duping it, odds are that immutable(char)[] makes the most sense.

- Jonathan M Davis


More information about the Digitalmars-d-announce mailing list