From: Jean-Hugues ROBERT Date: 2004-05-04T06:39:34+09:00 Subject: Re: Lazy evaluation (evil) At 17:24 03/05/2004 +0900, you wrote: >I would say the two remaining distinguishing characterstics for a >functional language are: >(1) discourage side effects >(2) functions as first class values > You can write a function that takes a function and returns a new > modified function with reasonable syntax. >Ruby, and indeed all object-oriented languages, fail (1) since the main >thing they do is to pass around mutable objects. (2) is a bit harder to >call. But I would say Ruby fails this too. Mainly because of the fact that >"methods" have a different calling syntax than "method objects" and "procs". Would the last one succeed if there was something like a Lvalue class, with auto dereferencing by the interpretor ? f = ref proc { |*args| p args } # or f = ref method :p, "ref" creates a Lvalue instance. f( "hello") # => ["hello"], proc/meth's getter() invoked, alias for []() p f # => [], proc's proc/meth's getter() invoked, alias for []() f = "world" # => ["world"], proc/meth's setter(x) invoked, alias for something like []=() ? getter/setter are bad names, I hope to find better ones by the time I issue the "match, assign & Lvalue" RCR. EOM Yours, Jean-Hugues >So I wouldn't say that Ruby is a functional language. > >// Niklas ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17