[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hash-table-*/default (Re: SRFI 69 update)



On Wed, Aug 31, 2005 at 08:30:12PM +0100, Tony Garnock-Jones wrote:
> > True, but the implementation is already there for those who want
> > something rigorous. :)
> So long as the implementation is *normative* and not simply
> *informative*, then fine. That needs to be made clear, though.

No, the problem is exactly that the implementation is half-normative,
half-informative.  If I specify the behaviour of e.g.
hash-table-ref/default by writing code, I must also specify just how
normative the implementation is.  For example, if I said:

	hash-table-ref/default

	Behaves as if defined by
	(define (hash-table-ref/default ht key default)
	  (hash-table-ref ht key (lambda () default)))

Then, is this a valid implementation anymore:

(define (hash-table-ref/default ht key default)
  (set! *log* (cons "hash-table-ref/default called" *log*))
  (hash-table-ref ht key (lambda () default)))

?  I would say it is not, because it does not behave anymore as if it
was defined as in the spec.  (value-)equivalence of expressions is
better because it makes contracts about the return value of a function
only.

I think I'm going for the "evaluates to" version, unless further
discussion emerges.

> > It's just that viewed differently, (hash-table-ref) can be seen as a
> > kind of control structure, similar to (and) or (if).
> Careful! The logical endpoint of this kind of thought is normal-order
> evaluation... :)

Indeed.

Panu

-- 
personal contact: atehwa@xxxxxx, +35841 5323835, +3589 85619369
work contact: panu.kalliokoski@xxxxxxxxxxx, +35850 3678003
kotisivu (henkkoht):	http://www.iki.fi/atehwa/
homepage (technical):	http://sange.fi/~atehwa/