Email list hosting service & mailing list manager

SRFI 229: Tagged Procedures Arthur A. Gleckler (31 Aug 2021 22:36 UTC)
tagged procedures vs procedure properties Per Bothner (31 Aug 2021 22:54 UTC)
Re: tagged procedures vs procedure properties John Cowan (31 Aug 2021 23:55 UTC)
Re: tagged procedures vs procedure properties Shiro Kawai (01 Sep 2021 01:20 UTC)
Re: tagged procedures vs procedure properties Per Bothner (01 Sep 2021 01:57 UTC)
Re: tagged procedures vs procedure properties Shiro Kawai (01 Sep 2021 02:49 UTC)
Re: tagged procedures vs procedure properties Marc Nieper-Wißkirchen (01 Sep 2021 07:32 UTC)
Re: tagged procedures vs procedure properties Per Bothner (02 Sep 2021 15:49 UTC)
Re: tagged procedures vs procedure properties Marc Nieper-Wißkirchen (02 Sep 2021 16:26 UTC)

Re: tagged procedures vs procedure properties Per Bothner 01 Sep 2021 01:57 UTC


On 8/31/21 6:19 PM, Shiro Kawai wrote:
> Mutable procedure property is a bit difficult to deal with.
>
>     (define (foo)
>        (lambda (x) x))
>
>     (define f1 (foo))
>     (define f2 (foo))
>
>     (set-procedure-property! f1 'prop 1)
>     (get-procedure-property! f2 'prop)  => What this should be?
>
> If f1 and f2 always need to be distinct objects, it restricts optimization severely.

I understand the concern, but I'm not sure we'd actually be missing anything.

I think an intuitive semantics is that each evaluation of (lambda ...)
conceptually creates a district procedure value - just like (cons ...) does.
If a compiler can determine that no-one modifies a procedure (either though
set-procedure-property! *or* by modifying closed mutable values) *and* no-one
compares the procedures using eq? then a compiler can merge them to a single
value - just as it can for pairs created by cons.

What real optimization would be lost under this semantics - which I suspect
matches most real implementations?
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/