[Io](http://www.iolanguage.com/)’s very self-documenting, at least when it comes to “what parameters does this and that take?” This is a little walk-through that gets you up and running in the interpreter. Get a binary from the downlaods page, and then come back here.
There is a docs
slot — with some text about what the method does. First, let’s list a string (in Io, known as a Sequence
, a sequence of characters, you know).
Whip out your Io interpreter, and write a string, and send the docs
message to it:
Io> "olle" docs ==> Object_0x6d5020: slots = Object_0x6d5060
There we go, a memory address for the docs, and a list of slots
. Open that!
Io> "olle" docs slots ==> Object_0x6d5060: alignCenter = Object_0x1120d90 alignLeft = Object_0x111fcf0 alignLeftInPlace = Object_0x111e810 alignRight = Object_0x1120530 findNthSeq = Object_0x1121870 interpolate = Object_0x11222f0 interpolateInPlace = Object_0x11226f0 removeSeq = Object_0x111f2d0 repeated = Object_0x6d4880
These contain documentation:
Io> "olle" docs slots repeated ==> Object_0x6d4880: args = List_0x6d4e20 description = "Returns a new sequence containing the receiver repeated aNumber number of times."
That is nice. But, there are many more methods on a Sequence. Where are the rest? Answer: not yet documented like this. Let’s go find the others.
Io> Sequence slotSummary ==> "": .. = method(arg, ...) afterSeq = Sequence_afterSeq() alignCenter = method(width, padding, ...) alignLeft = method(width, padding, ...) alignLeftInPlace = method(width, padding, ...) alignRight = method(width, padding, ...) append = Sequence_append() appendPathSeq = Sequence_appendPathSeq() appendSeq = Sequence_appendSeq() asBinaryNumber = Sequence_asBinaryNumber() asBuffer = Sequence_asBuffer() asCapitalized = Sequence_asCapitalized() asLowercase = Sequence_asLowercase() asMessage = Sequence_asMessage() asMutable = Sequence_asMutable() asNumber = Sequence_asNumber() asSimpleString = method(...) asString = Sequence_asString() asSymbol = Sequence_asSymbol() asUppercase = Sequence_asUppercase() at = Sequence_at() atInsertSeq = Sequence_atInsertSeq() atPut = Sequence_atPut() --- SNIPPED, FOR HER PLEASURE ---
That’s more like it! Notice the difference in the right-hand listing.
asNumber = Sequence_asNumber() asSimpleString = method(...)
asNumber
has a fast C implementation (the function name is a hint there), but asSimpleString
is pure Io.
The Io-implemented methods have their argument list with them, like alignRight
. The ellipsis (…) stands for the method body.
It’s possible to return any Io slot, serialized as a string. That includes all Io-implemented methods! Use the getSlot()
method:
Io> Sequence alignRight getSlot("serialized") ==> method(b, if(b ==(nil), setSlot("b", Sequence clone)); b appendSeq(self asMutable replaceSeq("\"", "\\\"") asSimpleString))
So, Io has some documentation, and you can read much of the code in the interpreter.
The [online reference docs](http://iolanguage.com/docs/reference/browser.cgi) are not to be trusted, but they are helpful at times.