Author: peter.seibel Date: Wed Mar 7 21:23:14 2007 New Revision: 9 Modified: trunk/faq.txt trunk/lispfaq.txt
Log: Moving continuation question from lispfaq to faq. Modified: trunk/faq.txt ============================================================================== --- trunk/faq.txt (original) +++ trunk/faq.txt Wed Mar 7 21:23:14 2007 @@ -799,7 +799,7 @@ value as \cl{AND} does. -*** I tried to create an array of objects with \cl{MAKE-ARRAY} and am seeing strange bugs. Why? +*** I created an array of objects with \cl{MAKE-ARRAY} and am seeing strange bugs. Why? Because \cl{MAKE-ARRAY} is a regular function, it's arguments are all evaluated before it is called. This can trip people up when they say @@ -807,13 +807,13 @@ (make-array 10 :initial-element (make-foo)) -when they mean to make an array of ten distinct \code{foo} objects. -When this expression is evaluated, \code{(make-foo)} is evaluated once -and the resulting object is passed to \cl{MAKE-ARRAY} which makes it -the value of all ten elements of the array. If the object is later -modified, the change will be visible via any and all elements of the -array. Of course if the object is immutable that probably wouldn't -matter which is why it's okay to say things like: +intending to make an array of ten distinct objects. When this +expression is evaluated, \code{(make-foo)} is evaluated once and the +resulting object is passed to \cl{MAKE-ARRAY} which makes it the value +of all ten elements of the array. If the object is later modified, the +change will be visible via any and all elements of the array. Of +course if the object is immutable that probably wouldn't matter which +is why it's okay to say things like: (make-array 10 :initial-element 0) @@ -822,6 +822,25 @@ (map-into (make-array 10) #'make-foo) + +** Why doesn't Lisp ... + +*** Why doesn't Common Lisp have continuations? + +Continuations are a great theoretical tool; if a language has +first-class, multiply-invocable continuations then one can build +threads, exceptions, coroutines, and the kitchen sink on top. + +However, such continuations present a a heavy burden for a Lisp +implementor and may preclude or at least complicate other desirable +optimizations. The ANSI standardizing committee decided that it would +be better to specify the user-level control structure (\cl{CATCH}, +\cl{UNWIND-PROTECT}, and so on) and let implementors choose whether to +build those on top of continuations or not. + +If you need to play with continuations, they are standard in Scheme +though make sure you pick a Scheme implementation that actually +supports them because they don't all. ** History Modified: trunk/lispfaq.txt ============================================================================== --- trunk/lispfaq.txt (original) +++ trunk/lispfaq.txt Wed Mar 7 21:23:14 2007 @@ -27,24 +27,6 @@ Are you in a breakpoint in FOO or in BAR? -*** What books should I read to learn more about lisp? - -*** Why doesn't Common Lisp have continuations? - -Continuations are a great theoretical tool; if a language has -first-class, multiply invocable continuations then one can build -threads, exceptions, coroutines, and the kitchen sink on top. - -However, there is an implementation burden with continuations; -supporting first-class, multiply invocable continuations complicates -things tremendously for the Lisp implementor. The ANSI standardizing -committee J13, mindful of this, took the view that it would be better -to specify the user-level control structure (CATCH, UNWIND-PROTECT, -and so on) and let implementors choose whether to build those on top -of continuations or not. - -If you need to play with continuations, you should use a Scheme implementation. - *** Why isn't there a DEEP-COPY function in the language? Copying an arbitrary structure or object needs context to determine _______________________________________________ cl-faq mailing list cl-faq@lispniks.com http://www.lispniks.com/mailman/listinfo/cl-faq