lexical binding and first class procedure 
Author Message
 lexical binding and first class procedure

I am going through a revision of my (very limited) CS knowledge since
I would like to introduce a couple of friends to scheme.

Is it correct to say that the distinction between lexical and dynamic
scope is particularly meaningful/important for languages with first
class procedures?



Tue, 15 Apr 2003 00:54:45 GMT  
 lexical binding and first class procedure

Quote:

> I am going through a revision of my (very limited) CS knowledge since
> I would like to introduce a couple of friends to scheme.

> Is it correct to say that the distinction between lexical and dynamic
> scope is particularly meaningful/important for languages with first
> class procedures?

You also need block structure.  If a language only allows `top-level'
procedures that cannot contain `free variables' then the question of
dynamic and lexical binding is moot.  But when you allow procedures to
be defined within the scope of another procedure, and you allow
procedures to have free variables, then it is important to say what
happens when you start passing these things around.

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



Tue, 15 Apr 2003 02:46:06 GMT  
 lexical binding and first class procedure

Quote:

> I am going through a revision of my (very limited) CS knowledge since
> I would like to introduce a couple of friends to scheme.

> Is it correct to say that the distinction between lexical and dynamic
> scope is particularly meaningful/important for languages with first
> class procedures?

This is a nice question.  I would say that scoping is slightly more
important with first class procedures than with second-class but
nested procedures (as in Pascal).  But the big difference in scoping's
importance is between languages with nested procedures of either class
(Scheme or Pascal) and languages with only top-level procedures (such
as C).

  -Max Hailperin
   Associate Professor of Computer Science
   Gustavus Adolphus College
   800 W. College Ave.
   St. Peter, MN 56082
   USA
   http://www.gustavus.edu/~max/



Tue, 15 Apr 2003 02:52:51 GMT  
 lexical binding and first class procedure

Quote:

>I am going through a revision of my (very limited) CS knowledge since
>I would like to introduce a couple of friends to scheme.

>Is it correct to say that the distinction between lexical and dynamic
>scope is particularly meaningful/important for languages with first
>class procedures?

I think it is fair to say that it is *particular* important in
languages with first class procedures, but here is an example
which doesn't use first-class procedures and produces a different answer
for lexically and dynamically scoped variables:

(define (dynamic-scope?)
   (define answer #f)
   (define (get-answer) answer)
   (define (get-answer-with-dynamic-scope answer)
      (get-answer))
   (get-answer-with-dynamic-scope #t))

Now, (dynamic-scope?) produces #f in Scheme and #t in a hypothetically
dynamically scoped "Scheme". Note that this only uses functions
in a second-class way, i.e. this code could be directly translated
to Pascal.

Stephan

--
ir. Stephan H.M.J. Houben
tel. +31-40-2474358 / +31-40-2743497



Tue, 15 Apr 2003 15:43:15 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. First Class Procedures are...?

2. Class procedure cannot call another class procedure

3. syntactic bindings as first-class values?

4. Additional Class binding appear after first click...

5. procedure variables vs. type-bound procedures

6. lexical vs dynamic binding in editor macro languages.

7. Upper boundry on lexical bindings

8. nested function definitions and lexical binding

9. LSP and constructors with first-class classes

10. First class classes

11. Re-Defining bindings in Text Widget or how to modify Class Bindings

12. First record never triggers TakeRecord procedure

 

 
Powered by phpBB® Forum Software