associative arrays

Manfred Nowak svv1999 at
Mon Jan 9 13:08:28 PST 2012

dennis luehring wrote:
> why is there an exception/error neeeded if missing?

Exceptions or errors are not _needed_.

Their existence stems from the modell under which the user of the 
operation _has_ to think about the operation, especially whether it 
  a:only the outcome of the operation or
  b:the amount of work to get to this outcome
and maybe 
  c:at runtime has to be known, whether the object exists.

Jesse Phillips wrote:
> I have a lot of if(exists) remove() in my code

As one can see, Jesse does not know, whether the object exists and 
has to ask, before he in fact removes the object, i.e. doubled access 
to the file, which may cause a slowdown.

As Jesse states the designer of the API has made up false assumptions 
about his knowledge, described in c:,  _and_ his interests, described 
in b:.

Jesse is interested only in the outcome of the operation, as 
described in a:,

Therefore the likely answer to your question stated at the beginning 
is: the designer of the API made a mistake.



More information about the Digitalmars-d-learn mailing list