From: Josh Cheek Date: 2010-12-08T05:36:17+09:00 Subject: Re: How to delay "string" interpretation? --0016363104e9a7d2660496d7f4c3 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Dec 7, 2010 at 2:24 PM, Fritz Trapper wrote: > Robert Klemme wrote in post #966874: > > f = lambda {|x,y| "#{x} + #{y}"} > > x = f["a", "b"] > > What happens in the 2nd line? f is a proc object, which gets passed an > array? > > -- > Posted via http://www.ruby-forum.com/. > > It isn't getting passed an array, it is having it's [] method invoked, which is just a synonym for the call method. f = lambda {|x,y| "#{x} + #{y}"} f.call( "a" , "b" ) f.[]( "a" , "b" ) f.call "a" , "b" f.[] "a" , "b" f.send "call" , "a" , "b" f.send "[]" , "a" , "b" http://www.ruby-doc.org/core/classes/Proc.html#M001555 --0016363104e9a7d2660496d7f4c3--