Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail From: 7stud -- Newsgroups: comp.lang.ruby Subject: Re: Telnet "More?" Date: Sun, 17 Apr 2011 17:47:46 -0500 Organization: Service de news de lacave.net Lines: 35 Message-ID: <4c00eb93cb86eea75501e223526dc08b@ruby-forum.com> References: <0bc1be8ec871e5fbad7753c695247ddc@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1303082539 71697 65.111.164.187 (17 Apr 2011 23:22:19 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Sun, 17 Apr 2011 23:22:19 +0000 (UTC) In-Reply-To: <0bc1be8ec871e5fbad7753c695247ddc@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381756 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <4c00eb93cb86eea75501e223526dc08b@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:3074 Eric T. wrote in post #993311: > In a slightly unrelated question, I don't understand why I have to do > this: > > out = lambda do |c| print c end > t.login('someusername', 'somepassword', &out) > t.cmd('dir', &out) > t.cmd('dir', &out) > > Rather than simply this: > > t.login('someusername', 'somepassword', &print) > t.cmd('dir', &print) > t.cmd('dir', &print) > > Seems kinda pointless to make a function... Which function are you referring to?? > which does nothing but pass > it's arguments unaltered to another function. Yes, that would be pointless, but where does such a function appear in your code? In your code, the & does two things: 1) It calls to_proc() on the specified object. print() is a method of the Kernel module, and Kernel doesn't define to_proc(). 2) It tells ruby to use the Proc object as a block. -- Posted via http://www.ruby-forum.com/.