On Thursday, 11 April 2013 at 10:16:39 UTC, John Colvin wrote:
On Thursday, 11 April 2013 at 10:03:39 UTC, deadalnix wrote:
On Thursday, 11 April 2013 at 08:36:13 UTC, Joseph Rushton Wakeling wrote:
On 04/10/2013 08:39 PM, Walter Bright wrote:
Sure there is. Declare the function as pure, and the function's parameters as
const or immutable.

Sure, I accept that. What I was meaning, though, was an up-front declaration which would make the compiler shout if those necessary conditions were not met.

i.e.

     pure foo(int n) { ... }     // compiles

strong pure bar(int n) { ... } // compiler instructs you to make // variables const or immutable

Both are strongly pure.

is foo strongly pure because of n being a value type that cannot contain any indirection? (i.e. as far as the outside world is concerned you don't get any side effects whatever you do with it).

Is the same for structs that contain no indirection? Or do they have to be const/immutable?

I don't know what the current implementation says, but it should be.

Reply via email to