Re: Problem building Io with the addons
gatesphere <[email protected]> Tue, 21 Feb 2012 10:06:57 -0500
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <[email protected]> |
I could send you the first couple of chapters of a book I'm working on, if you're interested. Send me an email at my personal address: [email protected], if you want them. -->Jake On 02/21/2012 09:01 AM, Duke Normandin wrote: > > On Tue, 21 Feb 2012 07:40:29 -0500 > gatesphere <[email protected] <mailto:gatesphere%40gmail.com>> wrote: > > Do you know of a great "prototype-based OOP" tutorial, for the OOP > challenged? :) Doesn't have to be Io based, simply applicable. > > Curious though! I've been hacking code ever since I bought my first > machine - an Apple][e back in 1981. First 6502, then Z80 assembly. > Got fluent with BASIC, then dove into K&R C in the late '80s - > didn't get far. After a 10 yr lull, I became fluent in Perl4 then > PHP. Now I do a lot of newLISP, but I've been "pulled" towards OOP > for a while now, but I HATE c++ and ObjectiveC et al. There's also > Slate and Factor though ... > > > 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 > > > > > > > > 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 > > > > > > > > > >