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

Re: [Scheme-reports] procedure identity



I like the concept of procedure location tags and procedure identity.
It enable a simple and sane semantics, and it enables useful
features such as associating properties with procedures.

The problem is I would like to allow the following to return true
(as it does in Kawa):

(define (maybe-negate negp)
   (if negp (lambda (x) (- x))
       (lambda (x) x)))
(eq? (maybe-negate #t) (maybe-negate #t))
;; Likewise for eqv?

I.e. the compiler can realize the two lambda
expressions don't depend on closed state, and
so it can move them to top-level and pre-allocate them.

Conceptually we have two kinds of procedures:
(1) Immutable "methods" without object identity.
(While the method is immutable, it may capture
mutable state, of course.)
(2) Mutable procedure objects, with object identity,
and a possibly-mutable set of named properties.

Perhaps the "large" language can support procedure
properties.  In that case procedure eqv? can be
defined in terms of the underlying method *and*
the properties.
-- 
	--Per Bothner
per@x   http://per.bothner.com/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports