Thanks! Now it's completely clear to me
dade.
···
4/29/2016, 11:28:07 PM пользователь Julien Negrotto (jtnegrotto@protonmail.com) написал:
Looking at proc.c, they're identical, and neither is an alias of the other.
https://docs.omniref.com/ruby/2.2.0/symbols/Proc/#line=2695
rb_define_method(rb_cProc, "call", proc_call, -1); rb_define_method(rb_cProc,
"[]", proc_call, -1); rb_define_method(rb_cProc, "===", proc_call, -1);
rb_define_method(rb_cProc, "yield", proc_call, -1);
Interestingly, `block.===` and `block.[]` do the same thing.
-------- Original Message --------Subject: yieldLocal Time: April 29,
2016 2:54 PMUTC Time: April 29, 2016 7:54 PMFrom: dimapg@rambler.ruTo:
ruby-talk@ruby-lang.org
I don't know if it is the right place to ask about it, but I'll try even
if I am egged:-)
we have
def calculate(first,second)
yield(first,second) if block_given?
end
def calculate(first, second, &block)
block.call(first, second) if block
end
def calculate(frist, second, &block)
block.yield(first, second) if block
end
Are examples 2,3 identical? Is yield method in context of explicit
parameter passing the same as call method?;
If they are the same, is one of them an alias?
I didn't find yield method in ruby-doc.org/core-2.3.0/Proc.html but it is
working on the ruby-2.3.0. Does it mean that this method will be removed
further?
In ruby-doc.org/core-2.2.0/Proc.html I didn't find any difference between
call and yield, but also I din't find if any of them is an alias.
dade.