home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / scheme / 2123 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  2.8 KB

  1. Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!zurich.ai.mit.edu!jinx
  2. From: jinx@zurich.ai.mit.edu (Guillermo J. Rozas)
  3. Newsgroups: comp.lang.scheme
  4. Subject: Re: wots going on here!?
  5. Message-ID: <JINX.92Aug31170432@chamarti.ai.mit.edu>
  6. Date: 31 Aug 92 21:04:32 GMT
  7. References: <1187.9208311520@subnode.aiai.ed.ac.uk> <17timvINN7b8@agate.berkeley.edu>
  8.     <17tn1uINNkij@early-bird.think.com>
  9. Sender: news@ai.mit.edu
  10. Reply-To: jinx@zurich.ai.mit.edu
  11. Organization: M.I.T. Artificial Intelligence Lab.
  12. Lines: 66
  13. In-reply-to: barmar@think.com's message of 31 Aug 92 18:05:50 GMT
  14.  
  15. In article <17tn1uINNkij@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
  16.  
  17. |       Application of inapplicable object #[undefined-value]
  18. |
  19. |       There is no environment available;
  20. |       using the current REPL environment
  21. |       ;Package: (user)
  22. |
  23. |   The user has to infer that #[undefined-value] is the default value of a
  24. |   variable, and that "Application of inapplicable object" means that he tried
  25. |   to use it as a function.  And even once he figures out what that means, it
  26. |   doesn't tell him where the undefined function came from.  Then there's the
  27. |   stuff about the environment, package, and the "REPL".  The following (from
  28. |   Lucid CL) is somewhat more reasonable (although it would probably have to
  29. |   be augmented to include Scheme-specific information):
  30. |
  31. |       >>Error: The function FOOBAR is undefined
  32. |
  33. |       SYMBOL-FUNCTION:
  34. |      Required arg 0 (S): FOOBAR
  35. |       :C  0: Try evaluating #'FOOBAR again
  36. |       :A  1: Abort to Lisp Top Level
  37. |
  38.  
  39. I won't disagree that the error message is obtuse at best, however you
  40. did not understand the error message even after my explanation, so
  41. please tell me what I (or it) should say, and perhaps we can spend
  42. another 3 days on each possible error message.
  43.  
  44. #[undefined value] is not the default value of any variable.
  45. The user would have gotten the "unbound variable" error instead.
  46.  
  47. #[undefined value] is what the implementation uses for the value of
  48. certain unspecified constructs in the language.
  49.  
  50. In particular, it is the value of a 1-armed IF whose predicate
  51. evaluated to false.  The value of a COND with no ELSE clause none of
  52. whose predicates matched, etc.
  53.  
  54. Although I have no idea what the code was, I can construct pieces of
  55. code that would generate it.
  56.  
  57. An example is
  58.  
  59. (define (foo x)
  60.   (if (even? x)
  61.       (lambda (x) (/ x 2))))
  62.  
  63. (define (bar y)
  64.   ((foo y) y))
  65.  
  66. and then used as
  67.  
  68. (bar 23)
  69.  
  70. There are many other ways to generate this error.
  71. BTW, the current version (in house) of MIT Scheme prints the
  72. following:
  73.  
  74. (bar 23)
  75. ;The object #[undefined-value] is not applicable.
  76. ;To continue, call RESTART with an option number:
  77. ; (RESTART 2) => Specify a procedure to use in its place.
  78. ; (RESTART 1) => Return to read-eval-print level 1.
  79.  
  80. Of course, you can also invoke (DEBUG).
  81.