List Info

Thread: doString with arguments?




doString with arguments?
country flaguser name
United States
2007-09-25 08:14:32

How do I call a method on self for which I have the slot name (in a
Sequence) when I also want to send along arguments in the message call?

Something like:

doString(methodName, 1)

but it gives exception. In this case I guess I could

doString("methodName(1)")

but in the general case when the data is more complex and might not be
easily serializable to a string, what can I do?

It seems to me that doMessage is what I'm after but not clear how I
can assemble the message I want. message() does not take a string?

__._,_.___
.

__,_._,___
Re: doString with arguments?
country flaguser name
United States
2007-09-25 09:54:33

robert_feldt wrote:

> How do I call a method on self for which I have the slot name (in a
> Sequence) when I also want to send along arguments in the message call?
>
> Something like:
>
> doString(methodName, 1)

You may be looking for performWithArgList:

"(methodName, argList)
Performs the method corresponding to methodName with the arguments in
the argList."

__._,_.___
.

__,_._,___
Re: doString with arguments?
country flaguser name
Canada
2007-09-25 16:06:42


Or just simply:

getSlot(slotThatHoldsTheName) call(arg1, arg2)

or perform(slotName, arg1, arg2)

--
Jeremy Tregunna
jtregunnablurgle.ca">jtregunnablurgle.ca



On 25-Sep-07, at 10:54 AM, John Nowak wrote:

robert_feldt wrote:

How do I call a method on self for which I have the slot name (in a
Sequence) when I also want to send along arguments in the message call?

Something like:

doString(methodName, 1)

You may be looking for performWithArgList:

"(methodName, argList)
Performs the method corresponding to methodName with the arguments in 
the argList."



Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    (Yahoo! ID required)

<*&gt; To change settings via email:
    iolanguage-digest@yahoogroups.com">mailto:iolanguage-digestyahoogroups.com 
    iolanguage-fullfeatured@yahoogroups.com">mailto:iolanguage-fullfeaturedyahoogroups.com

<*> To unsubscribe from this group, send an email to:
    iolanguage-unsubscribe@yahoogroups.com">iolanguage-unsubscribeyahoogroups.com

<*> Your use of Yahoo! Groups is subject to:


!DSPAM:46f92049524331504189220!


__._,_.___
.

__,_._,___
Re: doString with arguments?
country flaguser name
United States
2007-09-25 23:44:48

Jeremy Tregunna wrote:
&gt;
> Or just simply:
>
> getSlot(slotThatHoldsTheName) call(arg1, arg2)
&gt;
> or perform(slotName, arg1, arg2)

There's a difference between the two in terms of which context the
method will be called in, yes? I'm without an Io interpreter or the
ability to get one for the next couple days... long story...

- John

__._,_.___
.

__,_._,___
Re: doString with arguments?
country flaguser name
Canada
2007-09-26 07:09:55


The short answer is: not if you know what you're doing.

If you pass those to the same object (in my example, the locals) then no there's no real noticeable difference.

--
Jeremy Tregunna
jtregunnablurgle.ca">jtregunnablurgle.ca



On 26-Sep-07, at 12:44 AM, John Nowak wrote:

Jeremy Tregunna wrote:

Or just simply:

getSlot(slotThatHoldsTheName) call(arg1, arg2)

or perform(slotName, arg1, arg2)

There's a difference between the two in terms of which context the 
method will be called in, yes? I'm without an Io interpreter or the 
ability to get one for the next couple days... long story...

- John



Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    (Yahoo! ID required)

<*&gt; To change settings via email:
    iolanguage-digest@yahoogroups.com">mailto:iolanguage-digestyahoogroups.com 
    iolanguage-fullfeatured@yahoogroups.com">mailto:iolanguage-fullfeaturedyahoogroups.com

<*> To unsubscribe from this group, send an email to:
    iolanguage-unsubscribe@yahoogroups.com">iolanguage-unsubscribeyahoogroups.com

<*> Your use of Yahoo! Groups is subject to:


!DSPAM:46f9e311721701790161711!


__._,_.___
.

__,_._,___
Re: doString with arguments?
country flaguser name
United States
2007-09-26 09:28:57

Thanks John (and all of you who answered),

performWithArgList seems to be exactly what I'm after. In general, if I have a list of arguments and want to send them as (separate) arguments to a method how would I do that? Like for example in Ruby:

array = [1,2]
def mymethod(a,b)
  a+b
end
mymethod(*array)&nbsp; #=> returns 3

Sorry for my basic questions; I have a good grasp of the principles behind IO but it is a bit hard to find info about the details... Anyone knows if there are some IO books in the works?

Best regards,

Robert Feldt

On 9/25/07, John Nowak < johnjohnnowak.com">johnjohnnowak.com> wrote:

robert_feldt wrote:

> How do I call a method on self for which I have the slot name (in a
> Sequence) when I also want to send along arguments in the message call?
&gt;
> Something like:
&gt;
> doString(methodName, 1)

You may be looking for performWithArgList:

"(methodName, argList)
Performs the method corresponding to methodName with the arguments in
the argList.&quot;




--
Best regards,

/Robert Feldt
--
PhD, Assistant Professor in Software Engineering
Blekinge Institute of Technology
School of Engineering (APS)
SE-372 25 Ronneby
Sweden

Phone: +46 (0) 457 385 887
Mobile: +46 (0) 733 580 580

Web pages:
Research group: http://www.bth.se/tek/serl/
Research project: http://www.bth.se/besq/

__._,_.___
.

__,_._,___
[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )