Brian Candler wrote:
>...
> 
> You can write that almost exactly the same in Ruby of course: substitute
> proc { |foo| ... } for lambda foo:

Right, you've wrapped the block in a function. It strikes me as a minor 
wart (of the same sort that all languages have) that if you want to pass 
a single closure you use block syntax but if you want to pass multiple 
you switch to procs. I guess that keeps the syntax simpler.

> But Ruby gives you other choices. You could pass a method of an existing
> object, e.g. $stdout.method(:write) and $stderr.method(:write)

FYI, this also works for Python. I was just trying to generate an 
example that took multiple blocks but you're right, that wasn't the best 
one.

somefunc(sys.stdout.write, sys.stderr.write)

As far as I know, there is nothing in Python that can be named but 
cannot be passed to a function or assigned to a variable. In that sense, 
everything in Python is an object, even methods.

def help_start(title, obj):
         print title, type(obj)
         print obj
         print "".join(obj.__doc__.splitlines()[0:2])
         print

import sys

help_start("module object", sys)
help_start("file object", sys.stdout)
help_start("method object", sys.stdout.write)
help_start("class object", sys.stdout.__class__)
help_start("string object", sys.stdout.__doc__)

> If I were writing the above, rather than passing in two functions, I'd
> probably just pass in two IO-like objects, and call output_obj.write and
> error_obj.write respectively.

That's why it is a little silly that we spend so much time talking about 
the functional bits of the languages. (e.g. closures, generators, 
blocks, etc.) Of course Python also has a ".write" convention for file 
objects.

> I skipped over a lot of this discussion, but did anyone mention space-
> sensitive syntax? It's so nice to be able to put
> 
>   if false
>   ...
>   end
> 
> around a piece of code, and not have to re-indent the whole lot!

In Python you would put """ around it to achieve the same effect.

  Paul Prescod