Sacha Chua <[email protected]> writes:
> 2016-05-23 Emacs News
>
> * Coding: 
>
>   * Literal values and destructive functions 

(That is:
http://mbork.pl/2016-05-23_Literal_values_and_destructive_functions)

Wait, what?

Sure, sort is documented as modifying the LIST in place. And the setq
makes `foo` global, so ... maybe no surprise, or so. But if I eval

(defun destructive-havoc ()
  "Example of destructive havoc."
  (let ((foo '(1 3 2)))
        (message "before sort, foo is: %s" foo)
        (sort foo #'<)
        (message "after sort, foo is: %s" foo)))

and M-: (destructive-havoc) two times, I still get

before sort, foo is: (1 3 2)
after sort, foo is: (1 2 3)
before sort, foo is: (1 2 3)
after sort, foo is: (1 2 3)

in *Messages*. Could someone please explain that to me?



Reply via email to