News for hackers. Stuff that matters.
Re:Cheatsheet for the modern JavaScript by nerdponx on Sunday October 01, 2017 @09:33AM (#15377718)
I get your point, but I'm not sure I share your cynicism. For instance, a "constant" container with mutable contents is the first example given in Practical Common Lisp [0]:

    (defvar *db* nil)

    (defun add-record (cd) (push cd *db*))
    (defun make-cd (title artist rating ripped)
      (list :title title :artist artist :rating rating :ripped ripped))

    (add-record (make-cd "Roses" "Kathy Mattea" 7 t))
If you're concerned about this kind of thing, we should be encouraging novice programmers to stop using language features they don't understand.

[0]: http://www.gigamonkeys.com/book/practical-a-simple-database....

Re:Cheatsheet for the modern JavaScript by yorwba on Sunday October 01, 2017 @10:19AM (#15377948)
My Lisp is a bit rusty, but I think actual constants are written +with-pluses+, whereas * the-stars * indicate global variables. And that database isn't just internally mutable, sometimes it's replaced completely [0]:

  (defun load-db (filename)
    (with-open-file (in filename)
      (with-standard-io-syntax
        (setf *db* (read in)))))
[0]: http://www.gigamonkeys.com/book/practical-a-simple-database....