From: Carl Shapiro
Subject: What ever happened to dynamic closures?
Date: 
Message-ID: <ouysni3fjt1.fsf@panix3.panix.com>
Zetalisp and Maclisp supported dynamic closures.  Does anyone know why
this feature never made its way into Common Lisp?

From: Kent M Pitman
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <sfwheyjjnur.fsf@world.std.com>
Carl Shapiro <········@panix.com> writes:

> Zetalisp and Maclisp supported dynamic closures.  Does anyone know why
> this feature never made its way into Common Lisp?

1. They were a kind of weird kludge that didn't have a lot of semantics
behind it.

2. Their typical applications were largely wholly subsumed by CLOS.

What do you want to use them for?
From: Carl Shapiro
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <ouyn18bfdbd.fsf@panix3.panix.com>
Kent M Pitman <······@world.std.com> writes:

> 1. They were a kind of weird kludge that didn't have a lot of semantics
> behind it.
> 
> 2. Their typical applications were largely wholly subsumed by CLOS.
> 
> What do you want to use them for?

Nothing at all.  I had once heard that dynamic closures were at times
used to implementation parts of Flavors and was wondering what ever
happened to them.
From: Kent M Pitman
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <sfwr8xn41rw.fsf@world.std.com>
Carl Shapiro <········@panix.com> writes:

> Kent M Pitman <······@world.std.com> writes:
> 
> > 1. They were a kind of weird kludge that didn't have a lot of semantics
> > behind it.
> > 
> > 2. Their typical applications were largely wholly subsumed by CLOS.
> > 
> > What do you want to use them for?
> 
> Nothing at all.  I had once heard that dynamic closures were at times
> used to implementation parts of Flavors and was wondering what ever
> happened to them.

Well, they were probably used for the implementation of "special instance 
variables", if you thought such things were a good idea.  I never did.

You can kind of simulate them (by binding a special to a slot on entry
and then storing from the special back to the slot on exit).  It's not
quite the same.  But it'd be close enough for some purposes.  As I recall,
these were used for things like having a *standard-output* instance variable
in a closure, etc.  Having a standard-output slot in an instance and then
just putting (let ((*standard-input* (standard-input self))) ...) around 
method bodies doesn't do semantically the identical thing but seems like
it solves the same abstract problem.
From: Carl Shapiro
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <ouyae4aauy2.fsf@panix3.panix.com>
Kent M Pitman <······@world.std.com> writes:

> Well, they were probably used for the implementation of "special instance 
> variables", if you thought such things were a good idea.  I never did.

Fascinating, thanks!

What would be an example of a typical application of dynamic closures
that ended up being "largely wholly subsumed by CLOS"?
From: Kent M Pitman
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <sfwheyhkewi.fsf@world.std.com>
Carl Shapiro <········@panix.com> writes:

> Kent M Pitman <······@world.std.com> writes:
> 
> > Well, they were probably used for the implementation of "special instance 
> > variables", if you thought such things were a good idea.  I never did.
> 
> Fascinating, thanks!
> 
> What would be an example of a typical application of dynamic closures
> that ended up being "largely wholly subsumed by CLOS"?

If I remember right, you were allowed to substitute a closure for an 
instance in flavors, with send turning to funcall, and so you could
do something like

(defun quoting-stream-handler (op &rest args)
  (selectq op
    (:tyo
      (let ((ch (car args)))
        (selectq ch 
          (#\" (princ "&quot;" stream))
	  (#\& (princ "&amp;" stream))
          (otherwise (princ ch stream)))))
    (:which-operations '(:tyo :which-operations))
    (otherwise
      (stream-default-handler 'quoting-stream-handler op args))))

(defun make-quoting-stream (stream)
  (let-closed ((raw-stream stream))
    #'quoting-stream-handler))

[I think let-closed would implicitliy declare its bound vars special,
and I htin this was critical for a couple of reasons.   The handler
was usually defined separately, as above, and you'll note that the
stream-default-handler could re-call its argument stream (and the data
itw as closed over) by just getting a quoted symbol because that symbol
knew the environment through specials.  Had it used lexical closures,
there would have had to have been something like LABELS involved.]

Anyway, I might have gotten the syntax a bit wrong--I'm just doing it from
memroy--but the basic point really is the overall shape here.  And the
point is that you used this stuff to define things that were handled by
SELECTQ expressions (what CL calls CASE) in ways that were substitutes
for DEFMETHOD, and you used the special variables to substitute for 
class slots.

One funny thing about it all is I remember someone remarking that although
there were about 5 ways to make streams on the lispm, this one--the very
oldest technology--was the most common, just because it was best documented,
and easy to cut and paste.  (I don't think the example used html quoting,
but it was an equally simple example for an indenting stream or some such
simple thing...)
From: Bradford W. Miller
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <B72ABE18.6237%Bradford.W.Miller@motorola.com>
On 5/17/01 9:54 PM, in article ��RTICLE], "Carl Shapiro"
<········@panix.com> wrote:

> Zetalisp and Maclisp supported dynamic closures.  Does anyone know why
> this feature never made its way into Common Lisp?
> 

They're not in CL, but you can get them in any of the implementations I'm
aware of: spawn a process and bind your specials within that process. The
handle on the process is your closure.
From: Lieven Marchand
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <m3u22ir4ey.fsf@localhost.localdomain>
Carl Shapiro <········@panix.com> writes:

> Zetalisp and Maclisp supported dynamic closures.  Does anyone know why
> this feature never made its way into Common Lisp?

What's a dynamic closure?

-- 
Lieven Marchand <···@wyrd.be>
Gla�r ok reifr skyli gumna hverr, unz sinn b��r bana.
From: Barry Margolin
Subject: Re: What ever happened to dynamic closures?
Date: 
Message-ID: <G9gN6.25$6S3.1207@burlma1-snr2>
In article <··············@localhost.localdomain>,
Lieven Marchand  <···@wyrd.be> wrote:
>Carl Shapiro <········@panix.com> writes:
>
>> Zetalisp and Maclisp supported dynamic closures.  Does anyone know why
>> this feature never made its way into Common Lisp?
>
>What's a dynamic closure?

A closure that remembers dynamic bindings (i.e. special variable values)
rather than lexical bindings.

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.