This page is part of the web mail archives of SRFI 69 from before July 7th, 2015. The new archives for SRFI 69 contain all messages, not just those from before July 7th, 2015.
On Thu, Jul 07, 2005 at 10:58:06AM +0100, Tony Garnock-Jones wrote: > (hash-table-get valmap id > (lambda () (error "Object does not contain slot" > (desc-id-and-slot id slotname)))) I've also thought about this. I know the thunk version is more expressive. However, I also think that a simple default value is the common case. I'd like to have both. You propose using (always) or, why not, (value->thunk): > (define (always something) (lambda () something)) > (hash-table-get *forward-slots* id (always #f)) But it is not so neat and I should probably provide this routine as a part of this SRFI to prevent people writing it again and again. OTOH, it does not strictly "belong" into this SRFI. (Maybe somebody should write a SRFI for combinators?) Another option would be to treat defaults that satisfy procedure? specifically. But this might confuse people. It does not make the construction less expressive, though, as one can give really-procedure-defaults as: (hash-table-get ht key (lambda () (lambda ...))) I'd like to hear more opinions on this. Another complication is that I posted a final version of the SRFI some three days ago. I'm not sure what the SRFI process says about this. > rather than: > (let* ((*failure* "failure") > (result (hash-table-get valmap id *failure*))) > (if (eq? result *failure*) > (error "Object does not contain slot" > (desc-id-and-slot id slotname)) > result)) "failure" is not even guaranteed to be unique. Rather use something like (define *failure* (list '*failure*)) Panu -- personal contact: atehwa@xxxxxx, +35841 5323835, +3589 85619369 work contact: pkalliok@xxxxxxxxxxxxxxxx, +35850 3678003 kotisivu (henkkoht): http://www.iki.fi/atehwa/ homepage (technical): http://sange.fi/~atehwa/