From: Sean O'Dell Date: 2004-07-10T06:18:56+09:00 Subject: Re: Functional Ruby (Re: Why I don't use Ruby.) On Friday 09 July 2004 13:07, Sean Russell wrote: > "Sean O'Dell" wrote in message > news:<200407081308.50197.sean@celsoft.com>... > > > 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): > > > > function myfunc(a) > > b = anotherfunc(a) > > return sin(b) > > end > > Technically, in a purely functional language, you also shouldn't be > able to reassign a new value to 'b', once you set it. This has > nothing to do with the scope, and indeed, there are no such things as > "variables" in *purely* functional languages, because they shouldn't > vary. What you can have is aliases for values. Haskell, for example, > allows you to use "let" and "where" to assign values to aliases that > look alot like variables, but are immutable. I think that's an implementation feature, not a fundamental property of a functional language. There's no reason a functional language can't have use memory space lexically any way it sees fit. The outcome is the same: nothing stateful affects function performance, so you get consistent return values for your input. I think those sorts of properties are assigned after observing existing implementations, and don't really describe the core nature of a "functional language." If I implemented a language that was functional in nature, except that, within a function you could overwrite your own variable values, programmers using the language are virtually unaffected. They simply have to treat their own variables slightly differently, but all the benefits of functional programming are unchanged. Sean O'Dell