Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail From: 7stud -- Newsgroups: comp.lang.ruby Subject: Re: Generating Functions in Ruby Date: Wed, 25 May 2011 12:26:30 -0500 Organization: Service de news de lacave.net Lines: 37 Message-ID: References: <5e21af14-befb-406e-b1c3-6758fe1527ab@s14g2000vbi.googlegroups.com> <151562ef-aebd-4999-8b7b-816c21a7c6df@m40g2000vbt.googlegroups.com> <917a6bebd84192c90d0434fe9ec9e2a4@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 1306344409 93843 65.111.164.187 (25 May 2011 17:26:49 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Wed, 25 May 2011 17:26:49 +0000 (UTC) In-Reply-To: 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: 383752 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:5042 Andreas Lundgren wrote in post #1000859: >> --output:-- >> "x1.to_s, x2.to_s, x3.to_s, x4.to_s" >> >> Also, compare that output to the output your loop produces: >> >> "x1.to_s + ', ' + x2.to_s + ', ' + x3.to_s + ', ' + x4.to_s" >> >> You would get many errors using that string as an argument list for a >> method. > > I need this since parameters to win32ole are sent as a string with a > comma separated list of arguments. That is to send in x1=1, x2='A' and > x3=1.5 I do the call: > handle.call(['MethodNameIn','Params'],['x1, x2, x3', '1, A, 1.5']); > If you need to send the string 'x1, x2, x3', then you need to create that string, not this garbage: "x1.to_s + ', ' + x2.to_s + ', ' + x3.to_s + ', ' + x4.to_s" Do you not see the difference between these two strings: "x1, x2, x3" "x1.to_s + ', ' + x2.to_s + ', ' + x3.to_s + ', ' + x4.to_s" Do you not see that those strings have different lengths? You seem to think that ruby is going to do some type of eval on the second string and you will end up with the first string, but ruby is not going to do that. The second string above is a *string*, it is not an *expression*. -- Posted via http://www.ruby-forum.com/.