From: biran
Subject: what does "Scheme is a statically scoped programming language" mean?
Date: 
Message-ID: <1160722109.627082.124180@i42g2000cwa.googlegroups.com>
I 've read some words from a book:
     "Scheme is a statically scoped programming language"

--
the "statically scoped" was not very clear to me. and I search in
google with "statically scoped",
I found the following explaining:

"Scheme is a statically scoped programming language, which means that
each use of a variable is associated with a lexically apparent binding
of that variable. Algol is another statically scoped language."

-- this definition seems to be clear. but I was still confused.

Questions come to my head:
 1. what does "statically scoped" add functionality to a programming
language.
 2.  is there a language that is not 'statically scoped'?
 3. what is the difference between a  "statically scoped" language and
a "non-statically scoped" language.

Any comments?

Best regards.

From: Pascal Costanza
Subject: Re: what does "Scheme is a statically scoped programming language" mean?
Date: 
Message-ID: <4p8skjFho3t4U1@individual.net>
biran wrote:
> I 've read some words from a book:
>      "Scheme is a statically scoped programming language"
> 
> --
> the "statically scoped" was not very clear to me. and I search in
> google with "statically scoped",
> I found the following explaining:
> 
> "Scheme is a statically scoped programming language, which means that
> each use of a variable is associated with a lexically apparent binding
> of that variable. Algol is another statically scoped language."
> 
> -- this definition seems to be clear. but I was still confused.
> 
> Questions come to my head:
>  1. what does "statically scoped" add functionality to a programming
> language.
>  2.  is there a language that is not 'statically scoped'?
>  3. what is the difference between a  "statically scoped" language and
> a "non-statically scoped" language.
> 
> Any comments?

See Section 3 at http://oopweb.com/LISP/Documents/cltl/VolumeFrames.html

http://library.readscheme.org/servlets/search.ss?kwd=art+of+the+interpreter 
is also a very enlightening read.


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Pascal Bourguignon
Subject: Re: what does "Scheme is a statically scoped programming language" mean?
Date: 
Message-ID: <87y7rkacc0.fsf@thalassa.informatimago.com>
"biran" <··········@gmail.com> writes:

>  2.  is there a language that is not 'statically scoped'?

Yes, for example emacs lisp.

>  3. what is the difference between a  "statically scoped" language and
> a "non-statically scoped" language.

Compare:

(defvar f (let ((x 1))  (lambda () x)))
(let ((x 2)) (funcall f))
--> 2
(funcall f)
--> error: void-variable x

in emacs lisp vs.:


(define f (let ((x 1)) (lambda () x)))
(let ((x 2)) (f))
--> 1
(f)
--> 1

in scheme.


>  1. what does "statically scoped" add functionality to a programming
>     language.

It adds closures, that is self contained functions, and ease the
analysis of the function code: the variable referenced by a name is
directly evident from the text of the function, you don't need to
consider the various dynamic environment where the function is called
to determine what variable is denoted or not by the name.



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
You never feed me.
Perhaps I'll sleep on your face.
That will sure show you.