[racket] hash-ref

From: Jos Koot (jos.koot at telefonica.net)
Date: Sun Jul 18 09:26:00 EDT 2010

(hash-ref a-hash a-key a-value)
In the past a-value was required to be a procedure.
Now it can be anything.
 
Nice.
Two caveats though.
1. If the value of a-value happens to be a procedure to be stored, it may
unintentionally be called.
2. a-value may be an expresssion that takes much computation. This
computation is repeated every time the hash-ref line is evaluated.
 
Simply helped of course: I make it a habbit always to write or to have
macros expand to:
(hash-ref a-hash a-key (lambda () a-value))
 
In short, I do not well understand the reason to relax the contract of
hash-ref and hash-ref!.
Jos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100718/9f1a43f2/attachment.html>

Posted on the users mailing list.