From: Mikael Brockman Date: 2004-07-10T05:25:47+09:00 Subject: Re: Functional Ruby (Re: Why I don't use Ruby.) "Sean O'Dell" writes: > On Friday 09 July 2004 05:02, Florian Gross wrote: >> Sean O'Dell wrote: >> > >> > You can have variables in a functional language, but what you can't have >> > are globals that act statefully, causing any functions you write to >> > return different values when passed the same parameter values. You can >> > have (pseudocoded): >> >> As far as I know LISP does indeed have closures -- and I can emulate >> globals with them in Ruby like this: >> >> Oh, and about not having side-effects: Most functional languages have >> them when doing I/O. > > I don't remember closures from my LISP days, but perhaps that's a memory > issue. Ancient Lisps, such as Emacs Lisp, lack closures. They have anonymous functions, but they're dynamically scoped. Dynamical scoping is occasionally useful, but it mostly sucks. Non-ancient Lisps, starting with Scheme, use lexical scoping. > I/O has always been an exception, but I think you have to have > exceptions to get variance into the program and I/O is a common programming > paradigm and a great way to introduce variance. Note that there are purely functional languages with I/O: Haskell, Clean, Miranda, and probably more. mikael