Re: Problem building Io with the addons
gatesphere <[email protected]> Tue, 21 Feb 2012 07:40:29 -0500
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <[email protected]> |
Yup! You have it correct. I'm glad you chose a language like Io to learn OOP, rather than something like Java or C++. Io really lets you get down to the guts of what it means to be OO. -->Jake On 2/21/2012 1:44 AM, Duke Normandin wrote: > > On Mon, 20 Feb 2012 19:54:49 -0500 > gatesphere <[email protected] <mailto:gatesphere%40gmail.com>> 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 > >