Why Strings as Classes?

Sergey Gromov snake.scaly at gmail.com
Thu Aug 28 19:22:58 PDT 2008


Robert Fraser <fraserofthenight at gmail.com> wrote:
> First, a hash access is already time unbounded. hash["hello"] where 
> "hello" is not already in the hash will create a hash entry for hello. 
> This requires heap allocation, which can take arbitrarily long. So 
> having unbounded opIndex is in the language already!

Hash's opIndex() throws an ArrayBoundsError if given an unknown key. 
It's opIndexAssign() which allocates.

-- 
SnakE



More information about the Digitalmars-d mailing list