<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16588"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>I am not sure it is a good idea to add many
almost-synonyms in a language. I just was a little bit curious. The change is
backward compatible and I have no objections against it.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>Indeed values to be inserted for missing keys often are
#f or 0 or '( ). It types nicely not having to wrap these basic constants in a
thunk and to gain efficiency for free. You only have to be aware of the fact
that if the value to be inserted is to be or might be a procedure, such as
(lambda (x) x) as the most elementary procedure when building a hash of
procedures, you have to wrap it as (lambda ( ) (lambda (x) x)). Because the
latter does not capture any variables, it may even be optimized such as to avoid
multiple construction of the identity function.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>In this case I would write or have my macro or module
expand to for example:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>(define (identity x) x)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>(define (default) identity)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>(let loop ((...))</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010> ...</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010> (hash-ref! hash key default)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010> ...)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>I am pretty sure that in this case the identity
function is constructed once only.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=481380623-18072010>Jos</SPAN></FONT></DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Neil Van Dyke
[mailto:neil@neilvandyke.org] <BR><B>Sent:</B> 19 July 2010
00:22<BR><B>To:</B> Jos Koot<BR><B>Cc:</B> 'plt-scheme'<BR><B>Subject:</B> Re:
[racket] hash-ref<BR></FONT><BR></DIV>
<DIV></DIV>Jos Koot wrote at 07/18/2010 09:26 AM:
<BLOCKQUOTE cite=mid:04AD96DBB28646C7819414ACAF25F51D@JacobPC type="cite">
<META name=GENERATOR content="MSHTML 8.00.7600.16588">
<DIV><FONT size=2 face="Courier New"><SPAN
class=132071113-18072010>(hash-ref a-hash a-key a-value)</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=132071113-18072010>In the
past a-value was required to be a procedure.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=132071113-18072010>Now it
can be anything.</SPAN></FONT></DIV></BLOCKQUOTE>[...]<BR>
<BLOCKQUOTE cite=mid:04AD96DBB28646C7819414ACAF25F51D@JacobPC type="cite">
<DIV><FONT size=2 face="Courier New"><SPAN class=132071113-18072010><SPAN
class=132071113-18072010></SPAN></SPAN></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=132071113-18072010><SPAN
class=132071113-18072010>In short, I do not well understand the reason to
relax the contract of hash-ref and
hash-ref!.</SPAN></SPAN></FONT></DIV></BLOCKQUOTE><BR>This behavior seems a
little on the uncomfortable side of automagical to me, and -- although I can
understand the desire to keep the short name -- I would've preferred separate
procedures for the default-thunk and default-value variations.<BR><BR>Perhaps
the short-name procedure could be the automagical one, and there could be
longer-name procedures, like "hash-ref/default-thunk" and
"hash-ref/default-value", for people who prefer a little less automagic in
that regard.<BR><BR>
<DIV class=moz-signature>-- <BR><A class=moz-txt-link-freetext
href="http://www.neilvandyke.org/">http://www.neilvandyke.org/</A>
</DIV></BLOCKQUOTE></BODY></HTML>