Re: Problem building Io with the addons
Duke Normandin <[email protected]> Mon, 20 Feb 2012 23:44:30 -0700
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <20120220234430.3ae6c0d3@select-man> |
On Mon, 20 Feb 2012 19:54:49 -0500 gatesphere <[email protected]> wrote: > 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 Thanks for the quick explanation! I see where Server/start method defines "handleSocket" as well, to get the show on the road. And in your server sub-class, you re-define "handleSocket". Did I say all that correctly? I must admit that I'm *very* new to OOP! I've stayed away until I stumbled on Smalltalk, and then Self. I preferred the latter, but had issues getting it to work properly on the OS X box I was using at the time. Gave up on it. I'm hoping that Io will be an eye opener for me! :) -- Duke