Talk:Io Programming

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

[edit] Things to document

I think we need to add pages and samples for the following topics so that this book can really become a good starting point for comprehensive Io learning:

  • Common file operations (opening, reading lines of text, writing, reading bytes and lengths and seeking through binary files)
  • Socket operations (along the lines of file operations, but discuss Io's buffering and making connections or using servers and handlers in more detail)
  • Discuss the 'type' slot created on protos whose slot names are capitalized
  • Discuss the 'proto' and 'protos' slot and how and when to use appendProto or prependProto.

[edit] Error?

Enter the Io's interactive interpreter (by typing io at the console) and type the following:

write("Hello, world!\n")

With the interactive interpreter, this should look like:

user@computer:~$ io
Io> write("Hello, world!\n")
Hello, world!

==> "Hello, world!\n"

There is no message sent back in my Io version!? My output looks like this:

Io> write("Hello, world!\n")
Hello, world!

==> Nil

Use print, assign the string to a variable, put the code in a file then use io or try return it.

  • Not an error. Nil is the return value of the write method. The wikibook may be wrong, or the display is implementation dependant. -- Edwin

But there is an issue if you try to run Io in some implementations of Emacs and other 'shell' programs that offer readline, editline or some type of libedit for cmd history and edits. Io fails to output to Stdout in those cases, prehaps because it does not consider the re-directed STDOUT to be a handle. I have raised this issue in my blog at plymouthreliable.com