On Sat, 09 May 2009 11:43:09 -0500, Andrei Alexandrescu wrote: > If we want to get rid of newID, we'd write: > > writeln(dic.length, '\t', word); > dic[word] = dic.length; > > by the Python rule, and > > writeln(dic.length, '\t', word); > dic[word] = dic.length - 1; > > by the C# rule. > > What's best? > > > Andrei
Looking at it, I don't see dic[word] as increasing the length. Nothing has been added yet so why would it change? Ok, I realize a new location in memory has be reserved for storing a value, but at a glance it doesn't appear as though it is happening. You would also leave off the -1 if 'word' was already in there.
