home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / perl / 7061 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  2.1 KB

  1. Xref: sparky comp.lang.perl:7061 comp.lang.scheme:2610 comp.lang.tcl:1890
  2. Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!zurich.ai.mit.edu!markf
  3. From: markf@zurich.ai.mit.edu (Mark Friedman)
  4. Newsgroups: comp.lang.perl,comp.lang.scheme,comp.lang.tcl
  5. Subject: Re: Closures, Object-Oriented Equivalence, New version of Perl and TCL
  6. Date: 19 Nov 92 11:14:56
  7. Organization: M.I.T. Artificial Intelligence Lab.
  8. Lines: 47
  9. Message-ID: <MARKF.92Nov19111456@montreux.ai.mit.edu>
  10. References: <9211110521.AA01343@cs.columbia.edu> <9211180509.AA04035@cs.columbia.edu>
  11. Reply-To: markf@zurich.ai.mit.edu
  12. NNTP-Posting-Host: montreux.ai.mit.edu
  13. In-reply-to: thayer@cs.columbia.edu's message of Wed, 18 Nov 92 00:09:50 EST
  14.  
  15. In article <9211180509.AA04035@cs.columbia.edu> thayer@cs.columbia.edu (Charles Thayer) writes:
  16.  
  17. ** > For example, in Scheme, a 'define' saves the current environment and
  18. ** > leaves the ability to reach the enclosing (dynamic) environment:
  19. ** 
  20. **    That's not quite right.  DEFINE does not save the current environment.
  21. **    It only binds a value to a variable.
  22. ** 
  23. ** I was not refering to the scheme meaning of `environment'.  I meant
  24. ** the entire set of visible bindings.  In scheme the `environment' only
  25. ** holds the most immediate visible bindings.
  26.  
  27. I think that the distinction that the responder wanted to make was
  28. that DEFINE does no saving of any kind of environment at all. DEFINE
  29. is just a binding construct.
  30.  
  31. ** :)  Which brings up an interesting point in mit-scheme:
  32. ** 
  33. ** (begin
  34. **   (define a "moo")
  35. **   (define (foo) 
  36. **     (display a)
  37. **     (define a "bar")
  38. **     )
  39. **   (foo))
  40. ** 
  41. ** => Unassigned variable a
  42.  
  43. The code above is not legal Scheme. Internal defines must precede the
  44. body of procedure being defined.
  45.  
  46. ** Astute PERL users will notice that there are similar holes in the 
  47. ** implementation of the exact same thing with respect to the main
  48. ** package  :)  which I find ironic.
  49.  
  50. This is not an implementation hole in Scheme. It is a language design
  51. issue. The above code (if legal) would have an ambiguity which the
  52. Scheme designers chose to solve by making it illegal.
  53.  
  54. -Mark
  55. --
  56.  
  57. Mark Friedman
  58. 42 Wyatt St.
  59. Somerville, Ma. 02143
  60.  
  61. markf@zurich.ai.mit.edu
  62.