From: Kristof Bastiaensen Date: 2004-05-01T22:04:01+09:00 Subject: Re: Lazy evaluation (evil) On Sat, 01 May 2004 10:38:55 +0000, gabriele renzi wrote: > il Sat, 01 May 2004 12:29:59 +0200, Kristof Bastiaensen > ha scritto:: > > >> >>From a conceptual point of view is callcc very important. >>It is not just added because it may seem like a good feature, >>but because it makes Ruby a real functional language (like scheme). > > I think this sentence may be incorrect. > I mean, haskell, ocaml and lisp all does not have call/cc yet they're > functional languages. > (actually I'm not sure if lisp, ocaml and scheme can be defined as > functional languages, cause they're not pure ones, if I'm correct) You are right, I used the term "functional language" in a wrong way. Ruby isn't functional, because it doesn't encourage a functional programming style. A meant to say that Ruby treats functions and continuations as first class objects (just as in functional languages). You could take a scheme program and rewrite it in Ruby. It is a pity that the current Ruby-interpreter doesn't handle tail-recursive call's, I hope that will be in Ruby 2.0. Another point where Ruby would come short, is in scoping rules. Ruby has no equivalent for scheme "let". Especially with the new local-scoping rules, I have the impression that it isn't possible to have block local variables (or am I wrong?). Wouldn't it be useful to have a local indentifier, to mean the start of a new scope for these variables: a = "foo" 4.times do |i| local a = i * i end puts a => "foo" Kristof