Re: Problem building Io with the addons
gatesphere <[email protected]> Mon, 20 Feb 2012 19:54:49 -0500
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <[email protected]> |
Voodoo.
Actually, the aSocket there is a variable name. When you see aSocket in
my code, it is the name of a parameter passed into a method. Io uses
duck typing, kind of, so as long as whatever is bound to aSocket
responds to the slots you're trying to access, Io is happy. In this
case, handleSocket expects a Socket, so just act upon aSocket as if it
were a Socket. Server calls handleSocket (and hands it the Socket that
is created on connection) whenever it receives a new connection, and
handleSocket is where all the magic happens here.
If you're interested in how things work, (most) things in Io are
viewable in the REPL. Just do a
ObjectName slotSummary
to get a list of slots (values or methods) of an object, and a
ObjectName getSlot("slotName")
to get the value attached to a slot on an object. For example,
Io> Socket getSlot("host")
==> blah blah blah...
method(
address ip
)
-->Jake
On 2/20/2012 7:38 PM, Duke Normandin wrote:
>
> On Mon, 20 Feb 2012 19:16:46 -0500
> gatesphere <[email protected] <mailto:gatesphere%40gmail.com>> wrote:
>
> > Well, they are a relatively new addition (I just put them
> > together in November), and no one has touched the wikibook in
> > quite some time...
>
> I see!
>
> > Anyways, glad you're up to speed. And I did try that whois
> > example earlier... it is broken. I'll see if I can whip up a
> > working one for you sometime soon.
> > Hope you enjoy it :)
>
> Hang on to it, for a bit would you! I thought that I'd try my hand
> at fixing that "whois" code as a learning exercise. :)
>
> I noticed that in your "rpn-calculator" you never do a "Socket
> clone"! You simply use aSocket, and automagically things work for
> you! lol ... What's they diff? Has working with "Socket" changed,
> or are you using voodoo? :)
> --
> Duke
>
>