On Wed, 22 Sep 2010 15:52:03 -0400, Don <nos...@nospam.com> wrote:

Steven Schveighoffer wrote:
On Wed, 22 Sep 2010 15:21:57 -0400, klickverbot <s...@klickverbot.at> wrote:

On 9/22/10 9:14 PM, Steven Schveighoffer wrote:
Hypothetical counter-case

struct S
{
version(stronglypure)
string s;
else
char[] s;
}

pure foo(S s); // changes strength depending on S' contents

-Steve

This is a change to the signature of foo – S with the stronglypure version defined and S without it are two completely distinct types.
Wait, I didn't change foo's signature at all. This is what the OP meant by long-range changes. S can be defined far away from foo, and out of the author of foo's control.
 -Steve

Is that really what he meant?

Yes.

Note that foo() would need to be recompiled, and the silent change in strength would occur only if it still compiles despite a significant change in the definition of one of types.

If you change the definition of a type, you're always going to have influences everywhere it's used in a function definition. I'd hardly call that a 'long-range' change.

Consider the case of adding some new feature Y to S or a change in the internal implementation. The API from foo's perspective doesn't change one iota, but the purity could.

Reply via email to