Related articles |
---|
Static type-checking with dynamic scoping roberto@cernvax.cern.ch (1991-01-14) |
Static type-checking with dynamic scoping gateley@rice.edu (1991-01-15) |
Re: Static type-checking with dynamic scoping Chuck_Lins.SIAC_QMAIL@gateway.qm.apple.com (Chuck Lins) (1991-01-15) |
Re: Static type-checking with dynamic scoping brm@Neon.Stanford.EDU (Brian R. Murphy) (1991-01-15) |
Re: Static type-checking with dynamic scoping barmar@think.com (1991-01-16) |
Re: Static type-checking with dynamic scoping brm@Neon.Stanford.EDU (Brian R. Murphy) (1991-01-17) |
Re: Static type-checking with dynamic scoping mac@eleazar.dartmouth.edu (1991-01-21) |
Newsgroups: | comp.compilers |
From: | barmar@think.com (Barry Margolin) |
Keywords: | types, design, Lisp |
Organization: | Thinking Machines Corporation, Cambridge MA, USA |
References: | <9101160042.AA28163@Neon.Stanford.EDU> |
Date: | Wed, 16 Jan 91 18:53:11 GMT |
In article <9101160042.AA28163@Neon.Stanford.EDU> Brian R. Murphy <brm@Neon.Stanford.EDU> writes:
>It seems to me that one could consider (dynamically bound) free
>variables in a procedure to simply be additional parameters to the
>procedure. Then standard ML-like type inference could be done.
Does this work even when side-effects to dynamically-bound variables are
allowed, e.g.
(defvar *global* 0)
(defun modifier (x)
(setq *global* x))
(defun test (y)
(print *global*)
(modifier y)
(print *global*))
(let ((*global* 1))
(test 2))
I suppose you could consider dynamic variables also to be output parameters
for all the procedures you call, as well as being your own input
parameters.
What makes this difficult is that converting all these variables into
virtual parameters involves computing the entire dynamic call tree. This
might require several iterations in a language that allows dynamic
variables to be bound to procedures themselves. And in languages such as
Lisp, where the procedure name could be user-specified, the call tree
becomes very bushy; consider:
(defun call-it ()
(let ((form (read)))
(apply (symbol-function (car form))
(cdr form))))
(this is a simple EVAL-like function that reads a function-call form from
the user and invokes the function on the specified arguments, although it
doesn't evaluate the arguments).
--
Barry Margolin, Thinking Machines Corp.
barmar@think.com
{uunet,harvard}!think!barmar
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.