Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Question about scoping
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Edi Weitz  
View profile  
 More options Sep 10 2003, 6:58 am
Newsgroups: comp.lang.lisp
From: Edi Weitz <e...@agharta.de>
Date: 10 Sep 2003 12:58:15 +0200
Local: Wed, Sep 10 2003 6:58 am
Subject: Re: Question about scoping

On Wed, 10 Sep 2003 12:51:18 +0200, jblazi <jbl...@hotmail.com> wrote:
> A few years ago there were flame wars here as to whether Scheme was
> Lisp or not and if I remember correctly, E. said at the time that
> Scheme resembled Algol more that CL as Scheme use exclusively static
> scoping (I hope I remember correctly).  I believed him of course,
> but did not fully understand what that meant.

> Is not static (or lexical) scoping generally regarded as safer and
> better than dynamic scoping? What are the advantages of dynamic
> scoping if we do not take the simplicity of implementation into
> account?

> Please try to give a simple (idiotproof) explanation.

  * (defun foo (x) (format t "Result: ~A" (* x x)))

  FOO
  * (with-output-to-string (*standard-output*) (foo 3))

  "Result: 9"

FOO is a simple function which just prints to *STANDARD-OUTPUT*. But
because *STANDARD-OUTPUT* is dynamically scoped you can easily
"redirect" FOO's output to another stream without changing FOO.

See also

  <http://www.flownet.com/gat/specials.pdf>
  <http://cl-cookbook.sourceforge.net/io.html#redir>

Edi.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.