On 02/03/2017 11:43 AM, WhatMeWorry wrote:
On Friday, 3 February 2017 at 18:37:15 UTC, Johan Engelen wrote:
On Friday, 3 February 2017 at 17:20:43 UTC, WhatMeWorry wrote:
        [...]

The error is in this line. Instead of assigning to the `postProc` at
module scope, you are defining a new local variable and assigning to it.

[...]

Thank you so much.  This is where I deserve a big Duh.  I guess there is
no way to to make this idiot proof.  I'll print it out and hang it over
my desk.

No matter how experienced, these happen to most programmers. :-/ Somebody else had a similar problem just the other day on this forum.

The same problem somewhat commonly happens when one copy+pastes members into the constructor and assigns to them forgetting to remove the types:

struct S {
    int i;
    int j;

    this(int a) {
        // Declarations pasted from the members
        int i = 42 + a;    // meant 'i = 42 + a' (or this.i = ...)
        int j = 43 + a;
    }
}

Another related one is assigning to a parameter usually in the constructor:

struct S {
    int i;

    this(int i) {
        i = i;    // meant this.i = i
    }
}

Ali

Reply via email to