Here's my code:

module grammar;

class Grammar(T : ulong) {
    this(const T[] str) {
        auto grammar = str in grammarCache;

        if (grammar) {
            this = grammar.dup;
        } else {
            this = approximateSmallestGrammar(str);
            grammarCache[str] = this.dup;
        }
    }

    static Grammar approximateSmallestGrammar(const T[] str) {
        return new Grammar();
    }

    @property Grammar dup() {

    }

private:
    this() {}
    static Grammar[T[]] grammarCache;
};


Compiler says 'this' is not an lvalue. How would I accomplish what I want?

Reply via email to