Greetings,<br><br>I just joined here, so sorry if this has been posted before.<br><br>I'm reading TDPL and the example on page 8 doesn't compile.  I'm using the latest GDC with GCC 4.4.5.  I've checked the errata, but nothing for this error.<br>
<br>import std.stdio;<br>import std.string;<br><br>void main(){<br><br>     size_t[char[]] dictionary;<br>    foreach(line; stdin.byLine()){<br>              foreach(word; splitter(strip(line))){<br>                          if(word in dictionary) continue;<br>
                    auto newID = dictionary.length;<br>                          dictionary[word] = newID;<br>                    writeln(newID, '\t', word);<br>            }<br>    }<br>    //writeln(dictionary.length);<br>
}<br><br><br>This is the error:<br>dictionary.d:12: Error: associative arrays can only be assigned values with immutable keys, not char[]<br><br>If i use immutable keys, it works, but it defeats the purpose.  So what's wrong with the code?<br>