home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 213a.lha / Scheme / diff.doc < prev    next >
Text File  |  1996-02-14  |  8KB  |  255 lines

  1. ================================
  2. DIFFERENCES, ANNOYANCES AND BUGS
  3. ================================
  4.  
  5. Scheme
  6. Version 1.2
  7. 19-March-1988
  8.  
  9. The following is a list of implementation details and trouble spots.
  10. Not everything mentioned is a bug, but there are bugs here!
  11.  
  12.  
  13.  
  14. ================================================================================
  15.  
  16.  
  17.  
  18. call-with-current-continuation
  19. ------------------------------
  20. The procedure call-with-current-continuation is named call/cc
  21.  
  22.  
  23.  
  24. Dynamically-Wound I/O
  25. ---------------------
  26. The I/O procedures with-input-from-file and with-output-to-file, use
  27. dynamic-wind to ensure that their files are always open within their
  28. context, and are closed when control passes out of their context.
  29.  
  30. The procedures load, call-with-input-file and call-with-output-file are not
  31. dynamically-wound.  Thus, the file will be closed upon normal exit from
  32. these procedures' contexts, but not necesarily otherwise. (The garbage
  33. collector closes files after all references to them go away.) Once the file
  34. is closed, nonlocal entries (via continuations passed out) will encounter
  35. an I/O error; the file is not automatically reopened.
  36.  
  37. EXAMPLE
  38.  
  39.     :=> (define xxx
  40.       (call/cc
  41.         (lambda (return)
  42.           (with-output-to-file "CON:10/10/300/100/Wound-IO"
  43.         (lambda ()
  44.           (write (call/cc (lambda (later) (return later))))
  45.           (sleep 50) )))))
  46.     xxx
  47.     ; The window opens, then closes as soon as the
  48.     ; continuation named "later" is thrown out.
  49.  
  50.     :=> (define the-cont xxx)
  51.     the-cont
  52.  
  53.     :=> (the-cont "Hello again!")
  54.     xxx
  55.  
  56.     ; The window re-opens and the string "Hello again! is printed in it.
  57.     ; Approximately 1 second later, the window closes and xxx is
  58.     ; (mysteriously) re-defined.  The window will re-open and close
  59.     ; in the same way each time the-cont is applied.
  60.  
  61.  
  62.  
  63. delay
  64. -----
  65. The primitive procedure delay accepts more than one expression.
  66. (delay exp1 ...) is equivalent to (delay (begin exp1 ...))
  67.  
  68.  
  69.  
  70. Case-Sensitivity
  71. ----------------
  72. Character case is significant in symbols.  The standard specifies that
  73. symbol names should be converted to the system-preferred case when read.
  74. In this implementation, your symbol names are left in the case in which
  75. they were entered.
  76.  
  77. All keywords (e.g., define) are recognized as the lower-case version of
  78. their symbols.    This also includes format symbols used by number->string.
  79.  
  80. Character specifiers and number prefixes, on the other hand, are
  81. case-insensitive.  This is according to the standard.
  82.  
  83. EXAMPLES
  84.  
  85.     (DEFINE a 1)      --> ERROR    ; (assuming DEFINE is not a procedure)
  86.     (eq? 'Abc 'Abc)       --> #t        ; according to standard
  87.     (eq? 'Abc 'aBc)       --> #f        ; not according to standard
  88.     (eq? #\Space #\space) --> #t    ; according to standard
  89.     (= #X12 #x12)      --> #t    ; according to standard
  90.  
  91. I prefer case-sensitivity.  However, this should be switchable; it
  92. currently is not.  The next release will almost certainly have this fixed.
  93.  
  94.  
  95.  
  96. Syntax
  97. ------
  98. The non-essential special forms "let*", "case" and "do" are not directly
  99. implemented.  However, add-syntax! provides a means of adding new special
  100. forms, and the file "special-forms.scm" provides definitons for "let*"
  101. and "case".
  102.  
  103. Special forms currently are not careful about syntax errors which do not
  104. prevent necessary parts of the form to be accessed.  So while (let ((a)) a)
  105. will cause a syntax error, (if a b c d e f g h) will not.
  106.  
  107.  
  108.  
  109. Internal Definitions
  110. --------------------
  111. Internal definitions do not behave exactly as an equivalent letrec. Instead
  112. of first establishing all symbols which will be introduced into a new block
  113. and then evaluating the block's expressions, internal defines are merely
  114. evaluated as encountered.
  115.  
  116. This will be fixed, but for now it should not cause problems with "normal"
  117. code.  Unlike letrec, a variable will be unbound (rather than merely
  118. uninitialized) until its definition is evaluated.
  119.  
  120.  
  121.  
  122. Immutable Data
  123. --------------
  124. There is no concept of immutable data in the system.  Instead, private data
  125. passed out of the system internals is copied.  For example, even though the
  126. system allows (string-set! (symbol->string 'abc) 0 #\x), this will not
  127. affect the symbol abc.
  128.  
  129.  
  130.  
  131. Out-Of-Memory
  132. -------------
  133. If the system runs out of heap space and cannot allocate more, it will
  134. panic and abort (and without so much as a message!).  This needs to be
  135. fixed, but it will take some doing to clean up after such an error.  Still,
  136. it should at least give you the satisfaction of clicking a requester, even
  137. if you are still going to lose the stuff currently in the system!
  138.  
  139.  
  140.  
  141. Tags and the 68020
  142. ------------------
  143. The tags for Scheme object references are stored in bits 31:24.  On the
  144. 68000 and 68010, these could be left even during pointer dereferencing
  145. since these bits are not used by the processor in address calculations.
  146. However, the 68020 does use these bits.
  147.  
  148. In the system, no pointer is ever dereferenced without first stripping its
  149. tags.  This therefore is compatible with the 68020.  However, I assume that
  150. any pointer returned by AllocMem will always be "boxable", i.e., bits 31:24
  151. will all be 0.    I don't know if this conflicts with any plans for future
  152. versions of the Amiga or not.
  153.  
  154. As the system stands, it never verifies that AllocMem returned a boxable
  155. pointer (it never needs to on the A1000).  However, it should do this and
  156. either retry or abort if it gets a "bad" pointer.
  157.  
  158.  
  159.  
  160. number->string
  161. --------------
  162. Only the formats "int" and "heur" are recognized, and these are treated
  163. equivalently.  In addition, the modifiers "exactness" and "radix" may be
  164. supplied.
  165.  
  166. Number->string improperly allows more than one modifier of the same kind to
  167. appear.  Settings caused by the modifiers shadow those caused by earlier
  168. modifiers in the same format.  This can cause a misleading conversion:
  169.  
  170.     :=> (number->string #x12 '(int (radix o e) (radix x s)))
  171.     "#o12"
  172.  
  173. number->string has a strange representation for the system's most-negative
  174. number.  Try this:
  175.  
  176.     :=> (- -#x7FFFFFFF 1)
  177.  
  178.  
  179.  
  180. Numbers
  181. -------
  182. Only signed 32-bit numbers are supported.  Numbers from -#x7FFFFFFF to
  183. #x7FFFFFFF may be input.  The most-negative number -#x100000000 cannot be
  184. input, but is nevertheless internally represented.
  185.  
  186. Exactness is supported.
  187.  
  188. Only the binary versions of procedures such as + and < are provided.
  189. You may extend these procedures to allow arbitrary numbers of arguments
  190. by redefining them.  However, this will all eventually migrate down into
  191. the primitives.
  192.  
  193. I hope to get support for bignums and rationals soon....
  194.  
  195. The following (nonessential) numeric functions have been omitted:
  196.  
  197.     modulo        ; but it can be defined in terms of remainder
  198.     numerator
  199.     denominator
  200.     gcd
  201.     lcm
  202.     floor
  203.     ceiling
  204.     truncate
  205.     round
  206.     rationalize
  207.     exp
  208.     log
  209.     sin
  210.     cos
  211.     tan
  212.     asin
  213.     acos
  214.     atan
  215.     sqrt
  216.     expt
  217.     make-rectangular
  218.     make-polar
  219.     real-part
  220.     imag-part
  221.     magnitude
  222.     angle
  223.  
  224.  
  225.  
  226. Interrupts and Errors in read
  227. -----------------------------
  228. While a call to read waits, interrupts will not be acted upon.    Therefore,
  229. while at the ":=> " prompt, pressing CTRL-C causes no immediately
  230. observable behavior.  Entering some object (representation) at this point
  231. will cause the interrupt to be recognized by the interpreter.
  232.  
  233. The input stream is not flushed when an error occurs.  Therefore, if you
  234. type ))))))))) at the prompt, a long sequence of errors ensues.
  235.  
  236. Read errors (like illegal right parentheses) cause a string to be thrown to
  237. the error handler as the reason.  This should be changed to a symbol in
  238. order to make it easier for debuggers to recognize error types.  Other
  239. system-detected errors throw symbols.
  240.  
  241.  
  242.  
  243. eqv?
  244. ----
  245. The predicate eqv? (and thus its associated procedures memv and assv) is no
  246. smarter than eq?.
  247.  
  248.  
  249.  
  250. Other Omitted Procedures
  251. ------------------------
  252. transcript-on
  253. transcript-off
  254.  
  255.