J
Jacob Fugal
That's an impressive bit of gymnastics.
Gymnastics? What exactly did I twist?
I don't buy it as satisfying
the requirements of a closure, though, at this point. Self is just
something within the current scope, and we're back to an absurdly broad
redefinition of "closure".
What current scope are you referring to here? If you mean the scope
that was current when the block was created, then why does that not
make it a closure? Why is self different than some other variable
named b? If you don't mean the scope that was current when the block
was created, then you're mistaken, because it *is* the self that was
current when the block was created that is used. This is what others
were trying to demonstrate in the examples you dismissed as having
irrelevant variables.
Methods are "functions" in the technical, broadly interpreted computer
science definition of the term. They're just a special case of
"function" that requires more specific conditions to qualify as
"methods". A method is a function: a function is not necessarily a
method.
Ok, we're using different definitions of function. That's why I put
function in quotes when I said it, but I can see you want to be
pedantic. By your definition, a method is indeed a function.
But I counter your last statement: in Ruby, all functions are
necessarily methods, because you can't call a method/function without
a receiver. You can write it syntactically without a receiver, but in
that case a receiver of self is still implicit. In this sense, Ruby
has no "functions", only methods.
Jacob Fugal