On Fri, Nov 12, 2010 at 3:01 AM, Xavier Noria <fxn / hashref.com> wrote:

> When the function is invoked the pointer is *copied*, that is, an integer
> value is copied and linked to a local variable. The exact same thing
> happens if the parameter is int i.
>

The exact same thing also happens with a reference (at least in C++, I don't
know anything about Perl).


> The pointer value is copied into the number variable (pass by value).
> You can be certain the caller sees the exact same pointer when
> the function call returns.
>
>
Please re-read your blog with this in mind, since what you right here in
this quote are calling "pass by value" you, in your blog, call
"pass-by-reference".

http://img193.imageshack.us/img193/6480/refl.jpg

On Fri, Nov 12, 2010 at 4:03 AM, Y. NOBUOKA <nobuoka / r-definition.com>wrote:

> In the example, we can see these Method objects don't represent the
> method C#meth directly. Then, how do we obtain the object which
> represents the method C#meth directly? No, we can't. There is no way.
>
>
cmeth1 = meth_obj1.unbind
cmeth2 = meth_obj2.unbind

cmeth1 == cmeth2 # => true
cmeth1 == C.instance_method('meth') # => true
cmeth2 == C.instance_method('meth') # => true
C.instance_method('meth') == C.instance_method('meth') # => true



>  >> I think that Ruby users need not know how a Method object wraps a
> >> method, but they should know the fact that a Method object wraps a
> >> method and a method is not a object.
> >>
> > Why? Is that even a Ruby thing? It seems so out of place to me that I
> would
> > assume it is an MRI implementation detail. Do the other Rubies do it that
> > way? If so, is it just for efficiency where they are all objects as soon
> as
> > we need them to be, but keep it lazy and don't bother turning them into
> > objects until such time as we know we need it?
>
> Yes. It is a Ruby's concept that a method is not an object.
>
> Please see Ruby Draft Specification:
>
> http://www.ipa.go.jp/software/open/ossc/english/ruby/ruby_draft_specification.html
> Although this document is still draft version, it is a good document
> for us to learn the Ruby's fundamental concepts. In sec.6.3, they
> write about a method. Quoting from it:
>
> "A method is a procedure which, when invoked on an object, performs a
> set of computations on
> 10 the object. A method itself is not an object."
>
>
I will concede that you have a spec which says that a method is not an
object. However, I do so with reserve, because this same spec, in this same
paragraph it says "A method has one or more (when aliased) names associated
with it. An association between a name and a method is called a method
binding . When a name N is bound to a method M, N is called the name of the
binding, and M is called the value of the binding. A name bound to a method
is called the method name . A method can be invoked on an object by
specifying one of its names. The object on which the method is invoked is
called the receiver of the method invocation."

Yet, UnboundMethods still have names

String.instance_method("upcase") # => #<UnboundMethod: String#upcase>
String.instance_method("upcase").name # => :upcase