News for hackers. Stuff that matters.
Re:Ruby is not a callable orientated language by arohner on Sunday February 21, 2010 @06:28PM (#1141446)
"Aside from the errors in this sentence (blocks, procs and lambdas are all just Proc objects"

No, they're different: http://innig.net/software/ruby/closures-in-ruby.rb

Re:Ruby is not a callable orientated language by carbon8 on Sunday February 21, 2010 @06:57PM (#1141502)
They are indeed all Proc objects:

    Proc.new {}.class
    => Proc
    lambda {}.class
    => Proc
    proc {}.class
    => Proc
    def block_class(&block) block.class end
    block_class {}
    => Proc
That write-up does have some great info in it, though.

Edit: there's an interesting comment on wycats' post that suggests the &block creates a Proc, and that blocks themselves are neither objects nor callable, ie, they can only be used directly with yield. That makes sense.

Even in that case, the original point still stands; we're still only dealing with Methods and Procs.

Re:Ruby is not a callable orientated language by arohner on Monday February 22, 2010 @01:00AM (#1142059)
My link empirically demonstrates that all 7(!) constructs behave differently, regardless of what foo.class says. I personally have been burned by the differences between them, so I'll continue to support people differentiating between them, even if the interpret lies.
Re:Ruby is not a callable orientated language by carbon8 on Monday February 22, 2010 @11:00AM (#1142922)
"My link empirically demonstrates that all 7(!) constructs behave differently"

It explicitly doesn't. Read it again. Immediately after listing his 7 constructs he points out that a number of them are actually the same thing, and in the summary he clearly explains that there are only 4 different behaviors. His 7 constructs (which include methods and bare blocks) are actually only 3 or, arguably, 3.5/4 (his numbers in parens):

blocks, which aren't callable without being wrapped in a Proc in CRuby (1, 2)

Procs (two types: Proc.new/&block and lambda) (3, 4, 5, 6)

methods (7)

There two types of Procs, plain procs and lambda, with lambda's differences being how it checks arguments and its return behavior, as I noted yesterday in another comment in this discussion (http://news.ycombinator.com/item?id=1141030).

So, again, the original comment, "four goddamn callable types [Methods, Procs, Blocks, Lambdas]," neglects the fact that #call on the last three is actually just Proc#call.