lua-users home
lua-l archive

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


"John D. Ramsdell" wrote:
> 
> Edgar Toernig <froese@gmx.de> writes:
> 
> > Well, lexical and dynamic scope are the two basic scoping rules.
> > Not opposing rules but two sets that can exist together.
> 
> Are you asking if a language can have both lexically scoped and
> dynamically scoped variables at the same time?  Yes, this is true, but
> a language that allows some dynamic variables is not considered to be
> static or lexically scoped.

I would vote that such a language is both. Consider fluid-let in some
Schemes which does dynamic binding as opposed to the static bindings
created by let... and lambda, e.g.:

(define stdout (current-output-port))

(define (wrstdout x) (write x stdout))

(fluid-let ((stdout (open-output-file "redirected-output"))) (wrstdout
"Hello World"))

I'd say it's not so much a question of the language but of the
variables. One is lexically bound and the other is dynamically bound.


Dolfi

-- 
Adolf Mathias              EMail: dolfi at zkm dot de  Web: www.zkm.de
|||| / |< |||                 ZKM Basic Research - Grundlagenforschung
P.B. 6919 D-76049 Karlsruhe, Germany; fon +49 721-8100-1511, fax -1509