Arc Forumnew | comments | leaders | submitlogin
10 points by dido 5910 days ago | link | parent

I'll add one more thing: static binding. It's the only functional language/LISP dialect I've ever seen developed after the 1970's (besides Emacs Lisp) that still does dynamic binding. I decided that this would be lots of trouble for programming in the large, which is why I never decided to pursue it.

This NewLisp fragment (which is also valid Scheme) illustrates this:

  (let ((x 1))
       (let ((f (lambda (y) (+ x y))))
            (let ((g (lambda (f y) (let ((x 3)) (f y)))))
                 (g f 2))))
This form evaluates to 5 in NewLisp but 3 in Scheme. The equivalent in Arc:

  (let x 1
      (let f (fn (y) (+ x y))
             (let g (fn (f y) (let x 3 (f y)))
                 (g f 2))))
as expected evaluates to 3, so Arc also does static binding. Dynamic binding makes safe use of free variables in different contexts that much harder, and essentially makes referential transparency all but impossible. I cannot for the life of me, especially after reading Steele and Sussman's "The Art of The Interpreter", imagine why the designers of NewLISP thought it would be a good idea to use dynamic binding in their language. Static binding had a reputation in the past as carrying with it a performance hit, which is why RMS didn't use it for Emacs Lisp, but research done afterwards has shown that there are ways of doing it properly that don't sacrifice performance.