I've been following the examples in the book and on page 8 we have this:

import std.stdio;
import std.string;

void main(){

     size_t[string] dictionary;
    foreach(line; stdin.byLine()){
              foreach(word; splitter(strip(line))){
                          if(word in dictionary) continue;
                    auto newID = dictionary.length;
                          dictionary[word] = newID;
                    writeln(newID, '\t', word);
            }
    }
}

With the latest GDC, which I think uses the latest 2.051, I get this error:
dictionary.d:12: Error: associative arrays can only be assigned values with
immutable keys, not char[]

Someone told me on digitalmars-d.learn that it works with DMD, but I just
downloaded the latest DMD that was just released and I still get the same
error.

Is there a workaround to this? and why the error?

Reply via email to