[plt-dev] Suggestion: `with-hash'
2009/3/27 Ryan Culpepper <ryanc at ccs.neu.edu>:
> Eli Barzilay wrote:
>>
>> Here's a suggestion for a small addition to `scheme/base', with the
>> obvious meaning:
>>
>> (with-hash <hash> <key> <expr>)
>>
>> Lookup <key> in <hash> and return the found value. If there is
>> no value evaluate <expr>, store it in <hash> for the <key>, and
>> return it.
>> [...]
>>
>> Any objections?
>
> I don't like the name. I think you should make it a procedure (use the
> normal hash value/thunk convention) and name it 'hash-ref/default!' or
> something similarly descriptive.
If the last argument were a thunk then it would almost make sense to
just call it 'hash-ref!'. That feels like an oxymoron though =).
Henk