[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] procedure identity
- To: Gerald Jay Sussman <gjs@x>
- Subject: Re: [Scheme-reports] procedure identity
- From: Per Bothner <per@x>
- Date: Tue, 04 Jun 2013 16:20:17 -0700
- Cc: scheme-reports@x
- In-reply-to: <E1Uk03T-0000kt-7a@gjs-x1>
- References: <E1Uk03T-0000kt-7a@gjs-x1>
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*
Scheme-reports mailing list