1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 <head><meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"Generator" content=
"Pages 2.0.2" />
8 <link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"guide_files/guide.css" />
9 <script type=
"text/javascript" src=
"guide_files/guide.js"></script></head>
10 <body style=
"margin: 36pt 63pt 36pt 63.3pt; " onload=
"onPageLoad();">
11 <div><div style=
"margin: 72pt 0pt 0pt 0pt; width: 485.6pt; "><div class=
"paragraph Heading" style=
"line-height: 38pt; margin-bottom: 0pt; margin-top: 0pt; padding-top: 0pt; text-align: right; font-size: 32pt; line-height: 38pt;">Io, The Programming Language
</div>
12 <div class=
"paragraph Version" style=
"line-height: 118pt; font-size: 8pt; line-height: 10pt; text-decoration: none;"> </div>
13 <div class=
"paragraph Copyright" style=
"line-height: 10pt; font-size: 8pt; line-height: 10pt; text-decoration: none;"> </div>
14 <div class=
"paragraph Copyright" style=
"line-height: 10pt; "></div>
15 <div class=
"paragraph Heading" style=
"line-height: 29pt; ">Contents
</div>
17 <div style=
"margin: 18pt 0pt 0pt 36pt; width: 449.6pt; "><div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC681" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Introduction
</a></div>
18 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC1090" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Perspective
</a></div>
19 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC2441" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Getting Started
</a></div>
20 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC2457" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Downloading
</a></div>
21 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC2532" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Installing
</a></div>
22 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC3139" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Binaries
</a></div>
23 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC3508" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Running Scripts
</a></div>
24 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC3690" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Interactive Mode
</a></div>
25 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC5089" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Syntax
</a></div>
26 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC5137" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Expressions
</a></div>
27 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC5434" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Messages
</a></div>
28 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC6628" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Operators
</a></div>
29 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC7147" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Assignment
</a></div>
30 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC7540" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Numbers
</a></div>
31 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC7712" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Strings
</a></div>
32 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC8048" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Comments
</a></div>
33 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC8442" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Objects
</a></div>
34 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC8880" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Overview
</a></div>
35 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC8979" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Prototypes
</a></div>
36 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC9876" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Inheritance
</a></div>
37 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC11106" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Methods
</a></div>
38 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC11896" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Blocks
</a></div>
39 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC13825" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Forward
</a></div>
40 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC14231" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Resend
</a></div>
41 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC14523" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Super
</a></div>
42 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC14781" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Introspection
</a></div>
43 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC15891" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Control Flow
</a></div>
44 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC15904" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">true, false and nil
</a></div>
45 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC16107" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Comparison
</a></div>
46 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC16229" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Conditions
</a></div>
47 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC17081" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Loops
</a></div>
48 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC18503" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Importing
</a></div>
49 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC18905" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Concurrency
</a></div>
50 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC18917" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Coroutines
</a></div>
51 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC19256" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Scheduler
</a></div>
52 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC19435" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Actors
</a></div>
53 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC20564" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Yield
</a></div>
54 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC20766" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Pause and Resume
</a></div>
55 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC20918" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Futures
</a></div>
56 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC21799" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Exceptions
</a></div>
57 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC21810" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Raise
</a></div>
58 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC22153" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Try and Catch
</a></div>
59 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC22703" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Pass
</a></div>
60 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC23008" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Custom Exceptions
</a></div>
61 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC23148" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Primitives
</a></div>
62 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC23864" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Object
</a></div>
63 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC24100" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">List
</a></div>
64 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC26083" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Sequence
</a></div>
65 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC27607" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Ranges
</a></div>
66 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC28533" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">File
</a></div>
67 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC28810" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Directory
</a></div>
68 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC29611" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Date
</a></div>
69 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC30156" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Networking
</a></div>
70 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC31463" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">XML
</a></div>
71 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC31641" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Embedding
</a></div>
72 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC31651" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Coding Conventions
</a></div>
73 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC33140" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">IoState
</a></div>
74 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC33966" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Values
</a></div>
75 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC34746" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Bindings
</a></div>
76 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC34770" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Appendix
</a></div>
77 <div class=
"paragraph TOC_Heading_3" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 141.6pt; margin-top: 0pt; padding-top: 1pt; text-indent: -123.6pt; "><a href=
"#TOC34780" style=
"color: #3f3f3f; line-height: 13pt; opacity: 1.00; ">Grammar
</a></div>
78 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC36209" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">Credits
</a></div>
79 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC36750" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">References
</a></div>
80 <div class=
"paragraph TOC_Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 25pt; text-indent: -0pt; "><a href=
"#TOC36766" style=
"color: #000000; font-weight: bold; letter-spacing: -0.02em; line-height: 13pt; opacity: 1.00; ">License
</a></div>
81 <div class=
"paragraph Heading" style=
"line-height: 29pt; text-decoration: none;"> </div>
84 <div><div class=
"layout_style_149"><div class=
"paragraph"></div>
85 <div class=
"paragraph Heading" style=
"line-height: 29pt; padding-top: 0pt; "><a name=
"TOC681" id=
"TOC681"></a><span>Introduction
</span><span style=
"font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; font-size: 11pt; line-height: 13pt; "></span></div>
86 <div class=
"paragraph Quote" style=
"line-height: 13pt; ">Simplicity is the essence of happiness.
<br />
87 - Cedric Bledsoe
</div>
88 <div class=
"paragraph Body" style=
"line-height: 12pt; ">Io is a dynamic prototype-based programming language. The ideas in Io are mostly inspired by Smalltalk[
1] (all values are objects), Self[
2] (prototype-based), NewtonScript[
3] (differential inheritance), Act1[
4] (actors and futures for concurrency), Lisp[
5] (code is a runtime inspectable / modifiable tree) and Lua[
6] (small, embeddable).
</div>
89 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><a name=
"TOC1090" style=
"line-height: 17pt; " id=
"TOC1090"></a><span style=
"line-height: 17pt; ">Perspective
</span><span style=
"font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; line-height: 18pt; "></span></div>
90 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; padding-top: 10pt; ">Why Another Language?
</div>
91 <div class=
"paragraph Body" style=
"line-height: 12pt; ">The focus of programming language research for the last thirty years has been to combine the high level expressive power of Smalltalk and the performance of low level languages with little attention paid to advancing expressive power itself. Io’s purpose is to refocus attention on expressiveness by exploring higher level dynamic programming features with greater levels of runtime flexibility and simplified programming syntax and semantics.
</div>
92 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
93 <div class=
"paragraph Body" style=
"line-height: 12pt; ">In Io, all values are objects (of which, anything can change at runtime, including slots, methods and inheritance), all code is made up of expressions (which are runtime inspectable and modifiable) and all expressions are made up of dynamic message sends (including assignment and control structures). Execution contexts themselves are objects and activatable objects such as methods/blocks and functions are unified into blocks with assignable scope. Concurrency is made more easily manageable through actors and implemented using coroutines for scalability.
</div>
94 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; margin-bottom: 0pt; margin-left: 71.6pt; margin-top: 0pt; text-indent: 0pt; "><span style=
"line-height: 13pt; ">Practical Goals
</span><span style=
"font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; font-size: 11pt; line-height: 13pt; "></span></div>
95 <div class=
"paragraph Body" style=
"line-height: 12pt; ">To be a language that is:
</div>
96 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
97 <ol><li><ol><li><ol><li><ol><li><ol><li><ol><li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 90pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; margin-top: -1.2pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; ">simple
</span></div>
98 <ol><li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 9pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; margin-top: 1.2pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span>conceptually simple and consistent
</span></div>
100 <li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 9pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; ">easily embedded and extended
</span></div>
104 <li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 90pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; ">powerful
</span></div>
105 <ol><li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 9pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span>highly dynamic and introspective
</span></div>
107 <li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 9pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span>highly concurrent (via coroutines and async i/o)
</span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; "></span></div>
111 <li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 90pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; ">practical
</span></div>
112 <ol><li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 9pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; ">fast enough
</span></div>
114 <li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 9pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; ">multi-platform
</span></div>
116 <li style=
"line-height: 14.4pt; margin-left: 9pt; padding-left: 9pt; text-indent: -9pt; "><div class=
"paragraph Body_Bullet" style=
"line-height: 14.4pt; text-indent: -9pt; "><span style=
"color: #000000; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 14.4pt; opacity: 1.00; position: relative; text-decoration: none; text-transform: none; top: 1pt; " class=
"Bullet">•
</span><span style=
"width: 5pt; " class=
"Spacer"></span><span style=
"font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 14.4pt; ">a comprehensive set of standard packages which also have these goals
</span></div>
131 <div class=
"paragraph Heading" style=
"line-height: 29pt; "></div>
132 <div class=
"paragraph Heading" style=
"line-height: 29pt; "><a name=
"TOC2441" id=
"TOC2441"></a><span>Getting Started
</span></div>
133 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><a name=
"TOC2457" style=
"line-height: 17pt; " id=
"TOC2457"></a><span style=
"line-height: 17pt; ">Downloading
</span><span style=
"line-height: 17pt; "> </span><span style=
"line-height: 17pt; "></span></div>
134 <div class=
"paragraph Body" style=
"line-height: 12pt; ">Io distributions are available at:
</div>
135 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
136 <div class=
"paragraph Code" style=
"line-height: 11pt; "><a href=
"http://www.iolanguage.com" title=
"http://www.iolanguage.com" style=
"color: #0e009d; line-height: 11pt; opacity: 1.00; text-decoration: underline; ">http://www.iolanguage.com
</a></div>
137 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; "><a name=
"TOC2532" id=
"TOC2532"></a><span>Installing
</span></div>
138 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">To build, from the top folder, run:
</div>
139 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
140 <div class=
"paragraph Code" style=
"line-height: 11pt; ">make
</div>
141 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
142 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">Binaries will be placed in the _build/binaries subfolder. To install:
</div>
143 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
144 <div class=
"paragraph Code" style=
"line-height: 11pt; ">sudo make install
</div>
145 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
146 <div class=
"paragraph Body" style=
"line-height: 12pt; ">or, if you’d like the install to simply link to your development folder:
</div>
147 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
148 <div class=
"paragraph Code" style=
"line-height: 11pt; ">sudo make linkInstall
</div>
149 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
150 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">and to run the unit tests:
</div>
151 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
152 <div class=
"paragraph Code" style=
"line-height: 11pt; ">make test
</div>
153 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">Addons
</div>
154 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">Some of Io’s addons require libraries that may not be installed on your system already. To install these automatically, type either:
</div>
155 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
156 <div class=
"paragraph Code" style=
"line-height: 11pt; ">su -c
" sudo make aptget”</div>
157 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
158 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">or:</div>
159 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
160 <div class="paragraph Code
" style="line-height:
11pt;
">su -c "make emerge”
</div>
161 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
162 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">or:
</div>
163 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
164 <div class=
"paragraph Code" style=
"line-height: 11pt; ">sudo make port
</div>
165 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
166 <div class=
"paragraph Body" style=
"line-height: 12pt; ">Depending on which package installer you use. Port is macports/darwinports (http://www.macports.org/) for OSX.
</div>
167 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; "><a name=
"TOC3139" id=
"TOC3139"></a><span>Binaries
</span></div>
168 <div class=
"paragraph Body" style=
"line-height: 12pt; ">Io builds two executables and places them in the binaries folder. They are:
</div>
169 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
170 <div class=
"paragraph Code" style=
"line-height: 11pt; ">io_static
</div>
171 <div class=
"paragraph Code" style=
"line-height: 11pt; ">io
</div>
172 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
173 <div class=
"paragraph Body" style=
"line-height: 12pt; ">The io_static executable contains the vm with a minimal set of primitives all statically linked into the executable. The io executable contains just enough to load the iovm dynamically linked library and is able to dynamically load io addons when they are referenced.
</div>
174 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><a name=
"TOC3508" style=
"line-height: 17pt; " id=
"TOC3508"></a><span style=
"line-height: 17pt; ">Running Scripts
</span></div>
175 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">An example of running a script:
</div>
176 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
177 <div class=
"paragraph Code" style=
"line-height: 11pt; ">io samples/HelloWorld.io
</div>
178 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
179 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">There is no main() function or object that gets executed first in Io. Scripts are executed when compiled.
</div>
180 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><a name=
"TOC3690" style=
"line-height: 17pt; " id=
"TOC3690"></a><span style=
"line-height: 17pt; ">Interactive Mode
</span><span style=
"font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; font-size: 11pt; line-height: 13pt; "></span></div>
181 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">Running:
</div>
182 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
183 <div class=
"paragraph Code" style=
"line-height: 11pt; ">./_build/binaries/io
</div>
184 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
185 <div class=
"paragraph Body" style=
"line-height: 12pt; ">Or, if Io is installed, running:
</div>
186 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
187 <div class=
"paragraph Code" style=
"line-height: 11pt; ">io
</div>
188 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
189 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">will open the Io interpreter prompt.
</div>
190 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
191 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">You can evaluate code by entering it directly. Example:
</div>
192 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
193 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Io
> "Hello world!" println
</div>
194 <div class=
"paragraph Code" style=
"line-height: 11pt; ">==
> Hello world!
</div>
195 <div class=
"paragraph Body" style=
"line-height: 12pt; font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; font-size: 11pt; line-height: 13pt; text-decoration: none;"> </div>
196 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">Expressions are evaluated in the context of the Lobby:
</div>
197 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
198 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Io
> print
</div>
199 <div class=
"paragraph Code" style=
"line-height: 11pt; ">[printout of lobby contents]
</div>
200 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
201 <div class=
"paragraph Body" style=
"line-height: 12pt; ">If you have a .iorc file in your home folder, it will be evaled before the interactive prompt starts. Also, rlwrap can be used to add line history features:
</div>
202 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
203 <div class=
"paragraph Code" style=
"line-height: 11pt; ">rlwrap io
</div>
204 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">Inspecting objects
</div>
205 <div class=
"paragraph Body" style=
"line-height: 12pt; ">You can get a list of the slots of an object like this:
</div>
206 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
207 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Io
> someObject slotNames
</div>
208 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
209 <div class=
"paragraph Body" style=
"line-height: 12pt; ">To show them in sorted order:
</div>
210 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
211 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Io
> someObject slotNames sort
</div>
212 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
215 <div><div class=
"layout_style_6"><div class=
"paragraph"></div>
216 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; padding-top: 0pt; ">doFile and doString
</div>
217 <div class=
"paragraph Body" style=
"line-height: 12pt; ">A script can be run from the interactive mode using the doFile method:
</div>
218 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
219 <div class=
"paragraph Code" style=
"line-height: 11pt; ">doFile(“scriptName.io”)
</div>
220 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
221 <div class=
"paragraph Body" style=
"line-height: 12pt; ">The evaluation context of doFile is the receiver, which in this case would be the lobby. To evaluate the script in the context of some other object, simply send the doFile message to it:
</div>
222 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
223 <div class=
"paragraph Code" style=
"line-height: 11pt; ">someObject doFile(“scriptName.io”)
</div>
224 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
225 <div class=
"paragraph Body" style=
"line-height: 12pt; ">The doString method can be used to evaluate a string:
</div>
226 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
227 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Io
> doString(“
1+
1”)
</div>
228 <div class=
"paragraph Code" style=
"line-height: 11pt; ">==
> 2</div>
229 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
230 <div class=
"paragraph Body" style=
"line-height: 12pt; ">And to evaluate a string in the context of a particular object:
</div>
231 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
232 <div class=
"paragraph Code" style=
"line-height: 11pt; ">someObject doString(“
1 +
1”)
</div>
233 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">Command Line Arguments
</div>
234 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">Example of printing out command line arguments:
</div>
235 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
236 <div class=
"paragraph Code" style=
"line-height: 11pt; "><span>args foreach(k, v, write(
"'", v,
"'\n"))
</span><span style=
"font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; font-size: 11pt; line-height: 13pt; "></span></div>
237 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">launchPath
</div>
238 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">The Lobby
"launchPath" slot is set to the location on the initial source file that is executed.
</div>
239 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
240 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "></div>
241 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
242 <div class=
"paragraph Heading" style=
"line-height: 29pt; "><a name=
"TOC5089" id=
"TOC5089"></a><span style=
"font-family: 'Helvetica-Bold', 'Helvetica', 'Arial', 'sans-serif'; font-size: 24pt; font-weight: bold; line-height: 29pt; ">S
</span><span style=
"font-family: 'Helvetica-Bold', 'Helvetica', 'Arial', 'sans-serif'; font-size: 24pt; font-weight: bold; line-height: 29pt; ">yntax
</span></div>
243 <div class=
"paragraph Quote" style=
"line-height: 13pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style=
"line-height: 13pt; ">Less is more.
<br />
244 - Ludwig Mies van der Rohe
</span><span style=
"line-height: 13pt; "></span></div>
245 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; "><a name=
"TOC5137" id=
"TOC5137"></a><span>E
</span><span>xpressions
</span></div>
246 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><span style=
"line-height: 12pt; ">Io has no keywords or statements. Everything is an expression composed entirely of messages,
</span><span style=
"line-height: 12pt; ">each of which is a runtime accessible object
</span><span style=
"line-height: 12pt; ">. The informal BNF description:
</span><span style=
"line-height: 12pt; "></span></div>
247 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
248 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 89.7pt; margin-top: 0pt; text-indent: 0pt; "><table cellspacing=
"0" cellpadding=
"0" style=
"background: transparent; border-collapse: collapse; height: 65pt; width: 375pt; word-wrap: break-word; " id=
"id1"><tr><td style=
"background: transparent; border: 1pt #bfbfbf none; height: 63pt; width: 64pt; "><div><div style=
"margin: 5pt; width: 64pt; "><div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; font-weight: normal; line-height: 11pt;">exp
</div>
249 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; font-weight: normal; line-height: 11pt;">message
</div>
250 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; font-weight: normal; line-height: 11pt;">arguments
</div>
251 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; font-weight: normal; line-height: 11pt;">symbol
</div>
252 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; font-weight: normal; line-height: 11pt;">terminator
</div>
256 <td style=
"background: transparent; border: 1pt #bfbfbf none; height: 63pt; width: 309pt; "><div><div style=
"margin: 5pt; width: 309pt; "><div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 1pt; margin-top: 0pt; padding-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; line-height: 11pt;">::= { message | terminator }
</div>
257 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 1pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; line-height: 11pt;">::= symbol [arguments]
</div>
258 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 1pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; line-height: 11pt;">::= “(“ [exp [ { “,” exp } ]] “)”
</div>
259 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 1pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; line-height: 11pt;">::= identifier | number | string
</div>
260 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 1pt; margin-top: 0pt; padding-bottom: 0pt; text-indent: 0pt; font-family: 'Courier', 'serif'; font-size: 9pt; font-style: normal; line-height: 11pt;">::= “\n” | “;”
</div>
266 <span style=
"line-height: 12pt; "></span></div>
267 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
268 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><span style=
"line-height: 12pt; ">For
</span><span style=
"line-height: 12pt; ">performance reason
</span><span style=
"line-height: 12pt; ">s, String and Number literal messages have their results cached in their message objects.
</span></div>
269 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; "><a name=
"TOC5434" id=
"TOC5434"></a><span>Messages
</span></div>
270 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><span style=
"line-height: 12pt; ">Message arguments are passed as expressions and evaluated by the receiver. Selective evaluation of arguments
</span><span style=
"line-height: 12pt; ">can be used
</span><span style=
"line-height: 12pt; ">to implement control flow. Examples:
</span></div>
271 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
272 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 9pt; line-height: 11pt;">for(i,
1,
10, i println)
</div>
273 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 9pt; line-height: 11pt;">a := if(b ==
0, c +
1, d)
</div>
274 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
275 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><span style=
"line-height: 12pt; ">In the above code,
</span><span style=
"line-height: 12pt; "> “
</span><span style=
"line-height: 12pt; ">for” and “if” are just normal messages, not special forms or keywords.
</span></div>
276 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
277 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">Likewise, dynamic evaluation can be used with enumeration without the need to wrap the expression in a block. Examples:
</div>
278 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
279 <div class=
"paragraph Code" style=
"line-height: 11pt; ">people select(person, person age
< 30)
</div>
280 <div class=
"paragraph Code" style=
"line-height: 11pt; ">names := people map(person, person name)
</div>
281 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
282 <div class=
"paragraph Body" style=
"line-height: 12pt; ">Methods like map and select will typically apply the expression directly to the values if only the expression is provided:
</div>
283 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
284 <div class=
"paragraph Code" style=
"line-height: 11pt; ">people select(age
< 30)
</div>
285 <div class=
"paragraph Code" style=
"line-height: 11pt; ">names := people map(name)
</div>
286 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
287 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">There is also some syntax sugar for operators (including assignment), which are handled by an Io macro executed on the expression after it is compiled into a message tree. Some sample source code:
</div>
288 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
289 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Account := Object clone
</div>
290 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Account balance :=
0</div>
291 <div class=
"paragraph Code" style=
"line-height: 11pt; ">Account deposit := method(amount,
</div>
292 <div class=
"paragraph Code" style=
"line-height: 11pt; "> balance = balance + amount
</div>
293 <div class=
"paragraph Code" style=
"line-height: 11pt; ">)
</div>
294 <div class=
"paragraph Code" style=
"line-height: 11pt; text-decoration: none;"> </div>
295 <div class=
"paragraph Code" style=
"line-height: 11pt; ">account := Account clone
</div>
296 <div class=
"paragraph Code" style=
"line-height: 11pt; ">account deposit(
10.00)
</div>
297 <div class=
"paragraph Code" style=
"line-height: 11pt; ">account balance println
</div>
298 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
299 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; "><span style=
"line-height: 12pt; ">Like Self[
2], Io’s syntax does not distinguish between accessing a slot containing a method from one containing a variable.
</span><span style=
"line-height: 12pt; "></span></div>
300 <div class=
"paragraph Heading_1" style=
"line-height: 17pt; "><a name=
"TOC6628" id=
"TOC6628"></a><span>Operators
</span></div>
301 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt;">An operator is just a message whose name contains no alphanumeric characters (other than
":",
"_", '
"' or ".
") or is one of the following words: or, and, return. Example: </div>
302 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
303 <div class="paragraph Code
" style="line-height:
11pt;
">1 + 2</div>
304 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
305 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">This just gets compiled into the normal message: </div>
306 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
307 <div class="paragraph Code
" style="line-height:
11pt;
">1 +(2)</div>
308 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
309 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Which is the form you can use if you need to do grouping: </div>
310 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
311 <div class="paragraph Code
" style="line-height:
11pt;
">1 +(2 * 4)</div>
312 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
313 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Standard operators follow C's precedence order, so: </div>
314 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
315 <div class="paragraph Code
" style="line-height:
11pt;
">1 + 2 * 3 + 4</div>
316 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
317 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Is parsed as: </div>
318 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
319 <div class="paragraph Code
" style="line-height:
11pt;
">1 +(2 *(3)) +(4)</div>
320 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
321 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">User defined operators (that don't have a standard operator name) are performed left to right.</div>
322 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC7147
" id="TOC7147
"></a><span>Assignment</span></div>
323 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Io has two assignment messages, “:=” and “=”. </div>
324 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
325 <div class="paragraph Code
" style="line-height:
11pt;
">a := 1 </div>
326 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
327 <div class="paragraph Body
" style="line-height:
12pt;
">which compiles to:</div>
328 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
329 <div class="paragraph Code
" style="line-height:
11pt;
">setSlot(“a”, 1)</div>
330 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
331 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">which creates the slot in the current context. And:</div>
332 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
333 <div class="paragraph Code
" style="line-height:
11pt;
">a = 1 </div>
334 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
335 <div class="paragraph Body
" style="line-height:
12pt;
">which compiles to:</div>
336 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
337 <div class="paragraph Code
" style="line-height:
11pt;
">updateSlot(“a”, 1)</div>
338 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
339 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">which sets the slot if it is found in the lookup path or raises an exception otherwise. By overloading updateSlot and forward in the Locals prototype, self is made implicit in methods.</div>
340 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
343 <div><div class="layout_style_10
"><div class="paragraph
"></div>
344 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt;
"><a name="TOC7540
" id="TOC7540
"></a><span>Numbers</span></div>
345 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The following are valid number formats: </div>
346 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
347 <div class="paragraph Code
" style="line-height:
11pt;
">123</div>
348 <div class="paragraph Code
" style="line-height:
11pt;
">123.456</div>
349 <div class="paragraph Code
" style="line-height:
11pt;
">0.456</div>
350 <div class="paragraph Code
" style="line-height:
11pt;
">.456</div>
351 <div class="paragraph Code
" style="line-height:
11pt;
">123e-4</div>
352 <div class="paragraph Code
" style="line-height:
11pt;
">123e4</div>
353 <div class="paragraph Code
" style="line-height:
11pt;
">123.456e-7</div>
354 <div class="paragraph Code
" style="line-height:
11pt;
">123.456e2</div>
355 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
356 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Hex numbers are also supported (in any casing): </div>
357 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
358 <div class="paragraph Code
" style="line-height:
11pt;
">0x0</div>
359 <div class="paragraph Code
" style="line-height:
11pt;
">0x0F</div>
360 <div class="paragraph Code
" style="line-height:
11pt;
">0XeE</div>
361 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC7712
" id="TOC7712
"></a><span>Strings</span></div>
362 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
363 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Strings can be defined surrounded by a single set of double quotes with escaped quotes (and other escape characters) within. </div>
364 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
365 <div class="paragraph Code
" style="line-height:
11pt;
">s := "this is a \
"test\".\nThis is only a test.
"</div>
366 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
367 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Or for strings with non-escaped characters and/or spanning many lines, triple quotes can be used. </div>
368 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
369 <div class="paragraph Code
" style="line-height:
11pt;
">s := """this is a
"test".
</div>
370 <div class=
"paragraph Code" style=
"line-height: 11pt; ">This is only a test.
"""</div>
371 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC8048
" id="TOC8048
"></a><span>Comments</span></div>
372 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Comments of the //, /**/ and # style are supported. Examples: </div>
373 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
374 <div class="paragraph Code
" style="line-height:
11pt;
">a := b // add a comment to a line</div>
375 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
376 <div class="paragraph Code
" style="line-height:
11pt;
">/* comment out a group</div>
377 <div class="paragraph Code
" style="line-height:
11pt;
">a := 1</div>
378 <div class="paragraph Code
" style="line-height:
11pt;
">b := 2</div>
379 <div class="paragraph Code
" style="line-height:
11pt;
">*/</div>
380 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
381 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The "#
" style is useful for unix scripts: </div>
382 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
383 <div class="paragraph Code
" style="line-height:
11pt;
">#!/usr/local/bin/io</div>
384 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
385 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">That's it! You now know everything there is to know about Io's syntax. Control flow, objects, methods, exceptions are expressed with the syntax and semantics described above. </div>
386 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
387 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
388 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
389 <div class="paragraph Heading
" style="line-height:
29pt;
"></div>
390 <div class="paragraph Heading
" style="line-height:
29pt;
"><a name="TOC8442
" id="TOC8442
"></a><span>Objects</span></div>
391 <div class="paragraph Quote
" style="line-height:
13pt; color: #
616161; line-height:
13pt; opacity:
1.00;
">In all other languages we've considered [Fortran, Algol60, Lisp, APL, Cobol, Pascal], a program consists of passive data-objects on the one hand and the executable program that manipulates these passive objects on the other. Object-oriented programs replace this bipartite structure with a homogeneous one: they consist of a set of data systems, each of which is capable of operating on itself. - David Gelernter and Suresh J Jag</div>
392 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC8880
" id="TOC8880
"></a><span>Overview</span></div>
393 <div class="paragraph Body
" style="line-height:
12pt;
">Io’s guiding design principle is simplicity and power through conceptual unification. </div>
394 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; font-size:
11pt; line-height:
13pt; text-decoration: none;
"> </div>
395 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
89.7pt; margin-top:
0pt; text-indent:
0pt;
"><table cellspacing="0" cellpadding="0" style="background: transparent; border-collapse: collapse; height:
58pt; width:
375pt; word-wrap: break-word;
" id="id2
"><tr><td style="background: transparent; border:
1pt #bfbfbf none; height:
56pt; width:
150pt;
"><div><div style="margin:
5pt; width:
150.3pt;
"><div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; padding-top:
0pt; text-indent:
0pt;
"><span style="color: #
000000; font-style: italic; font-weight: bold; line-height:
12pt; opacity:
1.00;
">concept</span><span style="color: #
000000; font-style: italic; font-weight: normal; line-height:
12pt; opacity:
1.00;
"></span></div>
396 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; text-indent:
0pt; color: #
000000; font-style: italic; font-weight: normal; line-height:
12pt; opacity:
1.00;
">prototypes </div>
397 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; text-indent:
0pt; color: #
000000; font-style: italic; font-weight: normal; line-height:
12pt; opacity:
1.00;
">messages</div>
398 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; padding-bottom:
0pt; text-indent:
0pt; color: #
000000; font-style: italic; font-weight: normal; line-height:
12pt; opacity:
1.00;
">blocks with assignable scope</div>
402 <td style="background: transparent; border:
1pt #bfbfbf none; height:
56pt; width:
223pt;
"><div><div style="margin:
5pt; width:
222.7pt;
"><div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; padding-top:
0pt; text-indent:
0pt; color: #
000000; font-style: italic; font-weight: bold; line-height:
12pt; opacity:
1.00;
">unifies</div>
403 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; text-indent:
0pt; color: #
000000; font-style: italic; font-weight: normal; line-height:
12pt; opacity:
1.00;
">objects, classes, namespaces, locals functions,</div>
404 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; text-indent:
0pt; color: #
000000; font-style: italic; font-weight: normal; line-height:
12pt; opacity:
1.00;
">operators, calls, assignment, variable accesses</div>
405 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; padding-bottom:
0pt; text-indent:
0pt; color: #
000000; font-style: italic; font-weight: normal; line-height:
12pt; opacity:
1.00;
">methods, closures, functions</div>
411 <span style="font-family: 'Times-Roman', 'Times', 'Times New Roman', 'serif'; font-size:
11pt; line-height:
13pt;
"></span></div>
412 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC8979
" id="TOC8979
"></a><span>Prototypes</span></div>
413 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt;
"><span style="line-height:
12pt;
">In Io, everything is an object</span><span style="line-height:
12pt;
"> (</span><span style="line-height:
12pt;
">including the locals storage of a block and the namesp</span><span style="line-height:
12pt;
">ace itself) and a</span><span style="line-height:
12pt;
">ll actions are messages</span><span style="line-height:
12pt;
"> (</span><span style="line-height:
12pt;
">including assignment). </span><span style="line-height:
12pt;
">Objects are composed of a list of key/value pairs called slots, </span><span style="line-height:
12pt;
">and an internal list of objects from which it inherits called protos. </span><span style="line-height:
12pt;
">A slot’s key is a symbol (a unique immutable sequence) and it’s value can be any type of object.</span></div>
414 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
"> </div>
415 <div class="paragraph Heading_2
" style="line-height:
13pt;
">clone and init</div>
416 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">New objects are made by cloning existing ones. A clone is an empty object that has the parent in it’s list of protos. A new instance’s init slot will be activated which gives the object a chance to initialize itself. Like NewtonScript[3], slots in Io are create-on-write.</div>
417 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
418 <div class="paragraph Code
" style="line-height:
11pt;
">me := Person clone</div>
419 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
420 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">To add an instance variable or method, simply set it: </div>
421 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
422 <div class="paragraph Code
" style="line-height:
11pt;
">myDog name := "rover
"</div>
423 <div class="paragraph Code
" style="line-height:
11pt;
">myDog sit := method("I'm sitting\n
" print)</div>
424 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
425 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">When an object is cloned, its "init
" slot will be called if it has one.</div>
426 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC9876
" id="TOC9876
"></a><span>Inheritance</span></div>
427 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt;
"><span style="line-height:
12pt;
">When an object receives a message it looks for a matching slot, if not found, the lookup continues depth first recursively in its protos. Lookup loops are detected (at runtime) and avoided. If the matching slot contains an activatable object, such as a Block or CFunction, it is activated, if it contains any other type of value it returns the value. Io has no globals </span><span style="line-height:
12pt;
">and the root object in the Io namespace is called the Lobby.</span></div>
428 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
429 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Since there are no classes, there's no difference between a subclass and an instance. Here’s an example of creating a the equivalent of a subclass: </div>
430 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
431 <div class="paragraph Code
" style="line-height:
11pt;
">Io> Dog := Object clone</div>
432 <div class="paragraph Code
" style="line-height:
11pt;
">==> Object_0x4a7c0 </div>
433 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
434 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The above code sets the Lobby slot "Dog
" to a clone of the Object object. Notice it only contains a protos list contains a reference to Object. Dog is now essentially a subclass of Object. Instance variables and methods are inherited from the proto. If a slot is set, it creates a new slot in our object instead of changing the proto: </div>
435 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
436 <div class="paragraph Code
" style="line-height:
11pt;
"> Io> Dog color := "red
"</div>
437 <div class="paragraph Code
" style="line-height:
11pt;
"> Io> Dog</div>
438 <div class="paragraph Code
" style="line-height:
11pt;
"> ==> Object_0x4a7c0:</div>
439 <div class="paragraph Code
" style="line-height:
11pt;
"> color := "red
"</div>
440 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Multiple Inheritance</div>
441 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">You can add any number of protos to an object's protos list. When responding to a message, the lookup mechanism does a depth first search of the proto chain.</div>
442 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC11106
" id="TOC11106
"></a><span>Methods</span></div>
443 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">A method is an anonymous function which, when called, creates an object to store it's locals and sets the local’s proto pointer and it’s self slot to the target of the message. The Object method method() can be used to create methods. Example:</div>
444 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
445 <div class="paragraph Code
" style="line-height:
11pt;
">method((2 + 2) print)</div>
446 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
447 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">An example of using a method in an object: </div>
448 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
449 <div class="paragraph Code
" style="line-height:
11pt;
">Dog := Object clone</div>
450 <div class="paragraph Code
" style="line-height:
11pt;
">Dog bark := method("woof!
" print)</div>
451 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
452 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The above code creates a new "subclass
" of object named Dog and adds a bark slot containing a block that prints "woof!
". Example of calling this method:</div>
453 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
454 <div class="paragraph Code
" style="line-height:
11pt;
">Dog bark</div>
455 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
456 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The default return value of a block is the result of the last expression.</div>
457 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Arguments</div>
458 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Methods can also be defined to take arguments. Example: </div>
459 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
460 <div class="paragraph Code
" style="line-height:
11pt;
">add := method(a, b, a + b)</div>
461 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
462 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The general form is: </div>
463 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; line-height:
12pt; text-decoration: none;
"> </div>
464 <div class="paragraph PsuedoCode
" style="line-height:
13pt;
">method(<arg name 0>, <arg name 1>, ..., <do message>)</div>
465 <div class="paragraph PsuedoCode
" style="line-height:
13pt; text-decoration: none;
"> </div>
468 <div><div class="layout_style_19
"><div class="paragraph
"></div>
469 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt;
"><a name="TOC11896
" id="TOC11896
"></a><span>B</span><span>locks</span></div>
470 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">A block is the same as a method except it is lexically scoped. That is, variable lookups continue in the context of where the block was created instead of the target of the message which activated the block. A block can be created using the Object method block(). Example of creating a block:</div>
471 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
472 <div class="paragraph Code
" style="line-height:
11pt;
">b := block(a, a + b)</div>
473 <div class="paragraph Heading_2
" style="line-height:
13pt; margin-bottom:
0pt; margin-top:
0pt; padding-top:
22pt; line-height:
13pt;
">Blocks vs. Methods</div>
474 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">This is sometimes a source of confusion so it's worth explaining in detail. Both methods and blocks create an object to hold their locals when they are called. The difference is what the "proto
" and "self
" slots of that locals object are set to. In a method, those slots are set to the target of the message. In a block, they're set to the locals object where the block was created. So a failed variable lookup in a block's locals continue in the locals where it was created. And a failed variable lookup in a method's locals continue in the object to which the message that activated it was sent.</div>
475 <div class="paragraph Heading_2
" style="line-height:
13pt;
">call and self slots</div>
476 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">When a locals object is created, it’s self slot is set (to the target of the message, in the case of a method, or to the creation context, in the case of a block) and it’s call slot is set to a Call object that can be used to access information about the block activation:</div>
477 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
478 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
89.7pt; margin-top:
0pt; text-indent:
0pt;
"><table cellspacing="0" cellpadding="0" style="background: transparent; border-collapse: collapse; height:
82pt; width:
302pt; word-wrap: break-word;
" id="id3
"><tr><td style="background: transparent; border:
1pt #bfbfbf none; height:
80pt; width:
89pt;
"><div><div style="margin:
5pt; width:
89.4pt;
"><div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; padding-top:
0pt; text-indent:
0pt;
"><span style="font-style: italic; font-weight: bold; line-height:
12pt;
">slot</span><span style="font-style: italic; font-weight: normal; line-height:
12pt;
"></span></div>
479 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">call sender </div>
480 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">call message </div>
481 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">call activated</div>
482 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">call slotContext</div>
483 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
0pt; margin-top:
0pt; padding-bottom:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">call target</div>
487 <td style="background: transparent; border:
1pt #bfbfbf none; height:
80pt; width:
211pt;
"><div><div style="margin:
5pt; width:
210.6pt;
"><div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; padding-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: bold; line-height:
12pt;
">returns</div>
488 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">locals object of caller</div>
489 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">message used to call this method/block</div>
490 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">the activated method/block</div>
491 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">context in which slot was found</div>
492 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
1pt; margin-top:
0pt; padding-bottom:
0pt; text-indent:
0pt; font-style: italic; font-weight: normal; line-height:
12pt;
">current object</div>
498 <span style="line-height:
12pt;
"></span></div>
499 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Variable Arguments</div>
500 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The “call message” slot in locals can be used to access the unevaluated argument messages. Example of implementing if() within Io: </div>
501 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
502 <div class="paragraph Code
" style="line-height:
11pt;
">if := method(</div>
503 <div class="paragraph Code
" style="line-height:
11pt;
"> (call sender doMessage(call message argAt(0))) ifTrue( </div>
504 <div class="paragraph Code
" style="line-height:
11pt;
"> call sender doMessage(call message argAt(1))) ifFalse( </div>
505 <div class="paragraph Code
" style="line-height:
11pt;
"> call sender doMessage(call message argAt(2)))</div>
506 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
507 <div class="paragraph Code
" style="line-height:
11pt;
">myif(foo == bar, write("true\n
"), write("false\n
"))</div>
508 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
509 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The doMessage() method evaluates the argument in the context of the receiver.</div>
510 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
511 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">A shorter way to express this is to use the evalArgAt() method on the call object:</div>
512 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
513 <div class="paragraph Code
" style="line-height:
11pt;
">if := method(</div>
514 <div class="paragraph Code
" style="line-height:
11pt;
"> call evalArgAt(0) ifTrue(</div>
515 <div class="paragraph Code
" style="line-height:
11pt;
"><span> </span><span>call evalArgAt(</span><span>1</span><span>)</span><span>) ifFalse( </span></div>
516 <div class="paragraph Code
" style="line-height:
11pt;
"><span> </span><span>call evalArgAt(</span><span>2</span><span>)</span><span>)</span></div>
517 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
518 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
519 <div class="paragraph Code
" style="line-height:
11pt;
">myif(foo == bar, write("true\n
"), write("false\n
"))</div>
520 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
521 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC13825
" id="TOC13825
"></a><span>Forward</span></div>
522 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">If an object doesn't respond to a message, it will invoke its "forward
" method if it has one. Here’s an example of how to print the information related lookup that failed:</div>
523 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
524 <div class="paragraph Code
" style="line-height:
11pt;
">MyObject forward := method(</div>
525 <div class="paragraph Code
" style="line-height:
11pt;
"> write("sender =
", call sender, "\n
")</div>
526 <div class="paragraph Code
" style="line-height:
11pt;
"> write("message name =
", call message name, "\n
")</div>
527 <div class="paragraph Code
" style="line-height:
11pt;
"> args := call message argsEvaluatedIn(call sender)</div>
528 <div class="paragraph Code
" style="line-height:
11pt;
"> args foreach(i, v, write("arg
", i, " =
", v, "\n
") )</div>
529 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
530 <div class="paragraph Heading_1
" style="line-height:
17pt; margin-bottom:
0pt; margin-left:
71.6pt; margin-top:
0pt; text-indent:
0pt;
"><a name="TOC14231
" style="line-height:
17pt;
" id="TOC14231
"></a><span style="line-height:
17pt;
">Resend</span></div>
531 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Sends the current message to the receiver's proto with the context of self. Example: </div>
532 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
533 <div class="paragraph Code
" style="line-height:
11pt;
">A := Object clone</div>
534 <div class="paragraph Code
" style="line-height:
11pt;
">A m := method(write("in A\n
"))</div>
535 <div class="paragraph Code
" style="line-height:
11pt;
">B := A clone</div>
536 <div class="paragraph Code
" style="line-height:
11pt;
">B m := method(write("in B\n
"); resend)</div>
537 <div class="paragraph Code
" style="line-height:
11pt;
">B m</div>
538 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
539 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">will print: </div>
540 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
541 <div class="paragraph Code
" style="line-height:
11pt;
">in B</div>
542 <div class="paragraph Code
" style="line-height:
11pt;
">in A</div>
543 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
544 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">For sending other messages to the receiver's proto, super is used.</div>
545 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC14523
" id="TOC14523
"></a><span>Super</span></div>
546 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Sometimes it's necessary to send a message directly to a proto. Example: </div>
547 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
548 <div class="paragraph Code
" style="line-height:
11pt;
">Dog := Object clone</div>
549 <div class="paragraph Code
" style="line-height:
11pt;
">Dog bark := method(writeln("woof!
"))</div>
550 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
551 <div class="paragraph Code
" style="line-height:
11pt;
">fido := Dog clone</div>
552 <div class="paragraph Code
" style="line-height:
11pt;
">fido bark := method(</div>
553 <div class="paragraph Code
" style="line-height:
11pt;
"> writeln("ruf!
")</div>
554 <div class="paragraph Code
" style="line-height:
11pt;
"> super(bark)</div>
555 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
556 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
557 <div class="paragraph Body
" style="line-height:
12pt;
">Both resend and super are implemented in Io.</div>
560 <div><div class="layout_style_17
"><div class="paragraph
"></div>
561 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt; text-decoration: none;
"> </div>
562 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC14781
" id="TOC14781
"></a><span>Introspection</span></div>
563 <div class="paragraph Body
" style="line-height:
12pt;
">Using the following methods you can introspect the entire Io namespace. There are also methods for modifying any and all of these attributes at runtime.</div>
564 <div class="paragraph Heading_2
" style="line-height:
13pt;
">slotNames</div>
565 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The slotNames method returns a list of the names of an object’s slots:</div>
566 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
567 <div class="paragraph Code
" style="line-height:
11pt;
">Io> Dog slotNames</div>
568 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> list(“bark”)</span><span style="font-family: 'Helvetica-Bold', 'Helvetica', 'Arial', 'sans-serif'; font-size:
11pt; font-weight: bold; line-height:
13pt;
"></span></div>
569 <div class="paragraph Heading_2
" style="line-height:
13pt;
"><span>protos</span><span style="font-family: 'Helvetica-Bold', 'Helvetica', 'Arial', 'sans-serif'; font-size:
11pt; font-weight: bold; line-height:
13pt;
"></span></div>
570 <div class="paragraph Body
" style="line-height:
12pt;
">The protos method returns a list of the objects which an object inherits from:</div>
571 <div class="paragraph Body
" style="line-height:
12pt; font-family: 'Helvetica-Bold', 'Helvetica', 'Arial', 'sans-serif'; font-size:
11pt; font-weight: bold; line-height:
13pt; text-decoration: none;
"> </div>
572 <div class="paragraph Code
" style="line-height:
11pt;
">Io> Dog protos</div>
573 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> list(“Object”)</span><span style="font-family: 'Helvetica-Bold', 'Helvetica', 'Arial', 'sans-serif'; font-size:
11pt; font-weight: bold; line-height:
13pt;
"></span></div>
574 <div class="paragraph Heading_2
" style="line-height:
13pt; font-family: 'Helvetica-Bold', 'Helvetica', 'Arial', 'sans-serif'; font-size:
11pt; font-weight: bold; line-height:
13pt;
">getSlot</div>
575 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt;
"><span style="line-height:
12pt;
">T</span><span style="line-height:
12pt;
">he "getSlot
" method</span><span style="line-height:
12pt;
"> can be used to get the value of a block in a slot without activating it: </span></div>
576 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
577 <div class="paragraph Code
" style="line-height:
11pt;
">myMethod := Dog getSlot("bark
")</div>
578 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
579 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt;
"><span style="line-height:
12pt;
">Above, we've set the locals object’s "myMethod
" slot to the bark method. It's important to remember that if you then want use the </span><span style="line-height:
12pt;
">myMethod</span><span style="line-height:
12pt;
"> without activating it, you'll need to use the getSlot method: </span></div>
580 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
581 <div class="paragraph Code
" style="line-height:
11pt;
">otherObject newMethod := getSlot("myMethod
")</div>
582 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
583 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Here, the target of the getSlot method is the locals object.</div>
584 <div class="paragraph Heading_2
" style="line-height:
13pt;
">code</div>
585 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The arguments and expressions of methods are open to introspection. A useful convenience method is “code”, which returns a string representation of the source code of the method in a normalized form.</div>
586 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
587 <div class="paragraph Code
" style="line-height:
11pt;
">Io> method(a, a * 2) code</div>
588 <div class="paragraph Code
" style="line-height:
11pt;
">==> “method(a, a *(2))”</div>
589 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
590 <div class="paragraph Body
" style="line-height:
12pt;
"></div>
591 <div class="paragraph Heading
" style="line-height:
29pt;
"><a name="TOC15891
" id="TOC15891
"></a><span>Control Flow</span></div>
592 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC15904
" id="TOC15904
"></a><span>true, false and nil</span></div>
593 <div class="paragraph Body
" style="line-height:
12pt;
"><span>Io has predefined</span><span> singletons </span><span>for true, false and nil. true and false are used for boolean truth values and nil is typically used to indicate an unset or missing or unavailable value.</span></div>
594 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC16107
" id="TOC16107
"></a><span>Comparison</span></div>
595 <div class="paragraph Body
" style="line-height:
12pt;
">The standard comparison operations (==, !=, >=, <=, >, <) return either the true or false.</div>
596 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
597 <div class="paragraph Code
" style="line-height:
11pt;
">Io> 1 < 2</div>
598 <div class="paragraph Code
" style="line-height:
11pt;
">==> true</div>
599 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC16229
" id="TOC16229
"></a><span>Conditions</span></div>
600 <div class="paragraph Heading_2
" style="line-height:
13pt;
">if</div>
601 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The Lobby contains the condition and loop methods. A condition looks like: </div>
602 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
603 <div class="paragraph PsuedoCode
" style="line-height:
13pt;
">if(<condition>, <do message>, <else do message>)</div>
604 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; line-height:
12pt; text-decoration: none;
"> </div>
605 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Example: </div>
606 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
607 <div class="paragraph Code
" style="line-height:
11pt;
">if(a == 10, "a is
10" print)</div>
608 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
609 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The else argument is optional. The condition is considered false if the condition expression evaluates to false or nil, and is considered true otherwise.</div>
610 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The result of the evaluated message is returned, so: </div>
611 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
612 <div class="paragraph Code
" style="line-height:
11pt;
">if(y < 10, x := y, x := 0)</div>
613 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
614 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">is the same as: </div>
615 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
616 <div class="paragraph Code
" style="line-height:
11pt;
">x := if(y < 10, y, 0)</div>
617 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
618 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Conditions can also be used in this form (though not as efficiently): </div>
619 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
620 <div class="paragraph Code
" style="line-height:
11pt;
">if(y < 10) then(x := y) else(x := 2)</div>
621 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
622 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Else-if is supported: </div>
623 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
624 <div class="paragraph Code
" style="line-height:
11pt; font-size:
9pt; line-height:
11pt;
">if(y < 10) then(x := y) elseif(y == 11) then(x := 0) else(x := 2)</div>
625 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
626 <div class="paragraph Body
" style="line-height:
12pt;
">As well as Smalltalk style ifTrue, ifFalse, ifNil and ifNonNil methods:</div>
627 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
628 <div class="paragraph Code
" style="line-height:
11pt;
">(y < 10) ifTrue(x := y) ifFalse(x := 2)</div>
629 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
630 <div class="paragraph Body
" style="line-height:
12pt;
">Notice that the condition expression must have parenthesis surrounding it.</div>
631 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
634 <div><div class="layout_style_9
"><div class="paragraph
"></div>
635 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt;
"><a name="TOC17081
" id="TOC17081
"></a><span>Loops</span></div>
636 <div class="paragraph Heading_2
" style="line-height:
13pt;
">loop</div>
637 <div class="paragraph Body
" style="line-height:
12pt;
">The loop method can be used for “infinite” loops:</div>
638 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
639 <div class="paragraph Code
" style="line-height:
11pt;
">loop(“foo” println)</div>
640 <div class="paragraph Heading_2
" style="line-height:
13pt;
">while</div>
641 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Like conditions, loops are just messages. while() takes the arguments: </div>
642 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
643 <div class="paragraph PsuedoCode
" style="line-height:
13pt;
">while(<condition>, <do message>)</div>
644 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
645 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Example: </div>
646 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
647 <div class="paragraph Code
" style="line-height:
11pt;
">a := 1</div>
648 <div class="paragraph Code
" style="line-height:
11pt;
">while(a < 10, </div>
649 <div class="paragraph Code
" style="line-height:
11pt;
"> a print</div>
650 <div class="paragraph Code
" style="line-height:
11pt;
"> a = a + 1</div>
651 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
652 <div class="paragraph Heading_2
" style="line-height:
13pt;
">for</div>
653 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">for() takes the arguments: </div>
654 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
655 <div class="paragraph PsuedoCode
" style="line-height:
13pt;
">for(<counter>, <start>, <end>, <optional step>, <do message>)</div>
656 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
657 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The start and end messages are only evaluated once, when the loop starts.</div>
658 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
659 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Example: </div>
660 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
661 <div class="paragraph Code
" style="line-height:
11pt;
">for(a, 0, 10, </div>
662 <div class="paragraph Code
" style="line-height:
11pt;
"> a println</div>
663 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
664 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
665 <div class="paragraph Body
" style="line-height:
12pt;
">Example with a step:</div>
666 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
667 <div class="paragraph Code
" style="line-height:
11pt;
">for(x, 0, 10, 3, x println)</div>
668 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
669 <div class="paragraph Body
" style="line-height:
12pt;
">Which would print:</div>
670 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
671 <div class="paragraph Code
" style="line-height:
11pt;
">0</div>
672 <div class="paragraph Code
" style="line-height:
11pt;
">3</div>
673 <div class="paragraph Code
" style="line-height:
11pt;
">6</div>
674 <div class="paragraph Code
" style="line-height:
11pt;
">9</div>
675 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
676 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">To reverse the order of the loop, add a negative step: </div>
677 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
678 <div class="paragraph Code
" style="line-height:
11pt;
">for(a, 10, 0, -1, a println)</div>
679 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
680 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Note: the first value will be the first value of the loop variable and the last will be the last value on the final pass through the loop. So a loop of 1 to 10 will loop 10 times and a loop of 0 to 10 will loop 11 times.</div>
681 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
682 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Example of using a block in a loop: </div>
683 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
684 <div class="paragraph Code
" style="line-height:
11pt;
">test := method(v, v print)</div>
685 <div class="paragraph Code
" style="line-height:
11pt;
">for(i, 1, 10, test(i))</div>
686 <div class="paragraph Heading_2
" style="line-height:
13pt;
">repeat</div>
687 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The Number repeat method is simpler and more efficient when a counter isn’t needed.</div>
688 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
689 <div class="paragraph Code
" style="line-height:
11pt;
">3 repeat(“foo” print)</div>
690 <div class="paragraph Code
" style="line-height:
11pt;
">==> foofoofoo</div>
691 <div class="paragraph Heading_2
" style="line-height:
13pt;
">break and continue</div>
692 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The flow control operations break and continue are supported in loops. For example: </div>
693 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
694 <div class="paragraph Code
" style="line-height:
11pt;
">for(i, 1, 10, </div>
695 <div class="paragraph Code
" style="line-height:
11pt;
"> if(i == 3, continue)</div>
696 <div class="paragraph Code
" style="line-height:
11pt;
"> if(i == 7, break)</div>
697 <div class="paragraph Code
" style="line-height:
11pt;
"> i print</div>
698 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
699 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
700 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Would print: </div>
701 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
702 <div class="paragraph Code
" style="line-height:
11pt;
">12456</div>
703 <div class="paragraph Heading_2
" style="line-height:
13pt; color: #
5f5f5f; line-height:
13pt; opacity:
1.00;
">return</div>
704 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Any part of a block can return immediately using the return method. Example: </div>
705 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
706 <div class="paragraph Code
" style="line-height:
11pt;
">Io> test := method(123 print; return "abc
"; 456 print)</div>
707 <div class="paragraph Code
" style="line-height:
11pt;
">Io> test</div>
708 <div class="paragraph Code
" style="line-height:
11pt;
">123</div>
709 <div class="paragraph Code
" style="line-height:
11pt;
">==> abc</div>
710 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC18503
" id="TOC18503
"></a><span>Importing</span></div>
711 <div class="paragraph Body
" style="line-height:
12pt; padding-bottom:
0pt;
">The Importer proto implements Io’s built-in auto importer feature. If you put each of your proto’s in their own file, and give the file the same name with and “.io” extension, the Importer will automatically import that file when the proto is first referenced. The Importer’s default search path is the current working directory, but can add search paths using it’s addSearchPath() method. </div>
714 <div><div class="layout_style_18
"><div class="paragraph
"></div>
715 <div class="paragraph Body
" style="line-height:
12pt; padding-top:
0pt; text-decoration: none;
"> </div>
716 <div class="paragraph Heading
" style="line-height:
29pt;
"><a name="TOC18905
" id="TOC18905
"></a><span>Concurrency</span></div>
717 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC18917
" id="TOC18917
"></a><span>Coroutines</span></div>
718 <div class="paragraph Body
" style="line-height:
12pt;
"><span>Io uses coroutines (</span><span>user level cooperative threads)</span><span>, instead of preemptive OS level threads to implement concurrency. This avoids the substantial costs (memory, system calls, locking, caching issues, etc) associated with native threads and allows Io to support a very high level of concurrency with thousands of active threads.</span></div>
719 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC19256
" id="TOC19256
"></a><span>Scheduler</span></div>
720 <div class="paragraph Body
" style="line-height:
12pt;
">The Scheduler object is responsible for resuming coroutines that are yielding. The current scheduling system uses a simple first-in-first-out policy with no priorities.</div>
721 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC19435
" id="TOC19435
"></a><span>Actors</span></div>
722 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">An actor is an object with it's own thread (in our case, it’s own coroutine) which it uses to process it's queue of asynchronous messages. Any object in Io can be sent an asynchronous message by placing a @ or @@ before the message name. (think of the "a
" in @ as standing for "asynchronous
") </div>
723 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
724 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Example:</div>
725 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
726 <div class="paragraph Code
" style="line-height:
11pt;
"> result := self foo // synchronous </div>
727 <div class="paragraph Code
" style="line-height:
11pt;
"> futureResult := self @foo // async, immediately returns a Future</div>
728 <div class="paragraph Code
" style="line-height:
1pt; margin-bottom:
0pt; margin-top:
5.4pt; line-height:
1pt;
"> self @@foo // async, immediately returns nil</div>
729 <div class="paragraph Body
" style="line-height:
12pt; margin-top: -
0.1pt; text-decoration: none;
"> </div>
730 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
731 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">When an object receives an asynchronous message it puts the message in its queue and, if it doesn't already have one, starts a coroutine to process the messages in its queue. Queued messages are processed sequentially in a first-in-first-out order. Control can be yielded to other coroutines by calling "yield
". Example: </div>
732 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
733 <div class="paragraph Code
" style="line-height:
11pt;
"> obj1 := Object clone</div>
734 <div class="paragraph Code
" style="line-height:
11pt;
"> obj1 test := method(for(n, 1, 3, n print; yield))</div>
735 <div class="paragraph Code
" style="line-height:
11pt;
"> obj2 := obj1 clone</div>
736 <div class="paragraph Code
" style="line-height:
11pt;
"> obj1 @@test; obj2 @@test</div>
737 <div class="paragraph Code
" style="line-height:
11pt;
"> while(Scheduler activeActorCount > 1, yield)</div>
738 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
739 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">This would print "112233".</div>
740 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
741 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Here's a more real world example: </div>
742 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
743 <div class="paragraph Code
" style="line-height:
11pt;
"> HttpServer handleRequest := method(aSocket,</div>
744 <div class="paragraph Code
" style="line-height:
11pt;
"> HttpRequestHandler clone @@handleRequest(aSocket)</div>
745 <div class="paragraph Code
" style="line-height:
11pt;
"> )</div>
746 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
749 <div><div class="layout_style_11
"><div class="paragraph
"></div>
750 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt;
"><a name="TOC20564
" id="TOC20564
"></a><span>Yield</span></div>
751 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">An object will automatically yield between processing each of its asynchronous messages. The yield method only needs to be called if a yield is required during an asynchronous message execution. </div>
752 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC20766
" id="TOC20766
"></a><span>Pause and Resume</span></div>
753 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">It's also possible to pause and resume an object. See the concurrency methods of the Object primitive for details and related methods.</div>
754 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC20918
" id="TOC20918
"></a><span>Futures</span></div>
755 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Io's futures are transparent. That is, when the result is ready, they become the result. If a message is sent to a future (besides the two methods it implements), it waits until it turns into the result before processing the message. Transparent futures are powerful because they allow programs minimize blocking while also freeing the programmer from managing the fine details of synchronization.</div>
756 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Auto Deadlock Detection</div>
757 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt;
"><span style="line-height:
12pt;
">An advantage of using futures is that when a future requires a wait, it will check to see if pausing to wait for the result would cause a deadlock and if so, avoid the deadlock and raise an exception. I</span><span style="line-height:
12pt;
">t </span><span style="line-height:
12pt;
">performs</span><span style="line-height:
12pt;
"> this check by travers</span><span style="line-height:
12pt;
">ing</span><span style="line-height:
12pt;
"> the list of connected future</span><span style="line-height:
12pt;
">s</span><span style="line-height:
12pt;
">.</span><span style="line-height:
12pt;
"></span></div>
758 <div class="paragraph Heading_2
" style="line-height:
13pt;
">The @ and @@ Operators</div>
759 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The @ or @@ before an asynchronous message is just a normal operator message. So: </div>
760 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
761 <div class="paragraph Code
" style="line-height:
11pt;
"> self @test</div>
762 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
763 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Gets parsed as(and can be written as): </div>
764 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
765 <div class="paragraph Code
" style="line-height:
11pt;
"> self @(test)</div>
766 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
767 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
768 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
769 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
770 <div class="paragraph Heading
" style="line-height:
29pt;
"></div>
771 <div class="paragraph Heading
" style="line-height:
29pt;
"><a name="TOC21799
" id="TOC21799
"></a><span>Exceptions</span></div>
772 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC21810
" id="TOC21810
"></a><span>Raise</span></div>
773 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">An exception can be raised by calling raise() on an exception proto. </div>
774 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
775 <div class="paragraph PsuedoCode
" style="line-height:
13pt;
">exceptionProto raise(<description>)</div>
776 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; font-style: italic; line-height:
12pt; text-decoration: none;
"> </div>
777 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">There are three predefined children of the Exception proto: Error, Warning and Notification. Examples: </div>
778 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
779 <div class="paragraph Code
" style="line-height:
11pt;
">Exception raise("generic foo exception
")</div>
780 <div class="paragraph Code
" style="line-height:
11pt;
">Warning raise("No defaults found, creating them
")</div>
781 <div class="paragraph Code
" style="line-height:
11pt;
">Error raise("Not enough memory
")</div>
782 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC22153
" id="TOC22153
"></a><span>Try and Catch</span></div>
783 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">To catch an exception, the try() method of the Object proto is used. try() will catch any exceptions that occur within it and return the caught exception or nil if no exception is caught. </div>
784 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
785 <div class="paragraph Code
" style="line-height:
11pt;
">e := try(<doMessage>)</div>
786 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
787 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">To catch a particular exception, the Exception catch() method can be used. Example:</div>
788 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
789 <div class="paragraph Code
" style="line-height:
11pt;
">e := try(</div>
790 <div class="paragraph Code
" style="line-height:
11pt;
"> // ...</div>
791 <div class="paragraph Code
" style="line-height:
11pt;
">) </div>
792 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
793 <div class="paragraph Code
" style="line-height:
11pt;
">e catch(Exception,</div>
794 <div class="paragraph Code
" style="line-height:
11pt;
"> writeln(e coroutine backtraceString)</div>
795 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
796 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
797 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">The first argument to catch indicates which types of exceptions will be caught. catch() returns the exception if it doesn't match and nil if it does.</div>
798 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC22703
" id="TOC22703
"></a><span>Pass</span></div>
799 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">To re-raise an exception caught by try(), use the pass method. This is useful to pass the exception up to the next outer exception handler, usually after all catches failed to match the type of the current exception: </div>
800 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
801 <div class="paragraph Code
" style="line-height:
11pt;
">e := try(</div>
802 <div class="paragraph Code
" style="line-height:
11pt;
"> // ...</div>
803 <div class="paragraph Code
" style="line-height:
11pt;
">) </div>
804 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
805 <div class="paragraph Code
" style="line-height:
11pt;
">e catch(Error,</div>
806 <div class="paragraph Code
" style="line-height:
11pt;
"> // ...</div>
807 <div class="paragraph Code
" style="line-height:
11pt;
">) catch(Exception,</div>
808 <div class="paragraph Code
" style="line-height:
11pt;
"> // ...</div>
809 <div class="paragraph Code
" style="line-height:
11pt;
">) pass</div>
810 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
813 <div><div class="layout_style_12
"><div class="paragraph
"></div>
814 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt;
"><a name="TOC23008
" id="TOC23008
"></a><span>Custom Exceptions</span></div>
815 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Custom exception types can be implemented by simply cloning an existing Exception type: </div>
816 <div class="paragraph Code
" style="line-height:
11pt;
"> MyErrorType := Error clone</div>
817 <div class="paragraph Heading_1
" style="line-height:
17pt; text-decoration: none;
"> </div>
818 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
819 <div class="paragraph Body
" style="line-height:
12pt;
"></div>
820 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
821 <div class="paragraph Heading
" style="line-height:
29pt;
"><a name="TOC23148
" id="TOC23148
"></a><span>Primitives</span></div>
822 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Primitives are objects built into Io whose methods are typically implemented in C and store some hidden data in their instances. For example, the Number primitive has a double precision floating point number as it's hidden data and it’s methods that do arithmetic operations are C functions. All Io primitives inherit from the Object prototype and are mutable. That is, their methods can be changed. The reference docs contain more info on primitives.</div>
823 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
824 <div class="paragraph Body
" style="line-height:
12pt;
"><span>This document is not meant as a reference manual, but an </span><span>overview</span><span> of the base primitives and bindings is provided here to give the user a jump start and a feel for what is available and where to look in the reference documentation for further details.</span></div>
825 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC23864
" id="TOC23864
"></a><span>Object</span></div>
826 <div class="paragraph Heading_2
" style="line-height:
13pt;
">The ? Operator</div>
827 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Sometimes it's desirable to conditionally call a method only if it exists (to avoid raising an exception). Example: </div>
828 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
829 <div class="paragraph Code
" style="line-height:
11pt;
">if(obj getSlot("foo
"), obj foo)</div>
830 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
831 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Putting a "?
" before a message has the same effect: </div>
832 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
833 <div class="paragraph Code
" style="line-height:
11pt;
">obj ?foo</div>
834 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC24100
" id="TOC24100
"></a><span>L</span><span>ist</span></div>
835 <div class="paragraph Body
" style="line-height:
12pt;
">A List is an array of references and supports all the standard array manipulation and enumeration methods. Examples:</div>
836 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
837 <div class="paragraph Body
" style="line-height:
12pt;
">Create an empty list:</div>
838 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
839 <div class="paragraph Code
" style="line-height:
11pt;
">a := List clone</div>
840 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
841 <div class="paragraph Body
" style="line-height:
12pt;
"><span>Create a list of arbitrary objects</span><span> using the list() method: </span></div>
842 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
843 <div class="paragraph Code
" style="line-height:
11pt;
"><span>a := list(33, </span><span>"a
"</span><span>)</span></div>
844 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
845 <div class="paragraph Body
" style="line-height:
12pt;
">Append an item:</div>
846 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
847 <div class="paragraph Code
" style="line-height:
11pt;
">a append(“b”)</div>
848 <div class="paragraph Code
" style="line-height:
11pt;
">==> list(33, “a”, “b”)</div>
849 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
850 <div class="paragraph Body
" style="line-height:
12pt;
">Get the list size:</div>
851 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
852 <div class="paragraph Code
" style="line-height:
11pt;
">a size</div>
853 <div class="paragraph Code
" style="line-height:
11pt;
">==> 3</div>
854 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
855 <div class="paragraph Body
" style="line-height:
12pt;
"><span>Get</span><span> the</span><span> item at </span><span>a given index (</span><span>List indexes begin at zero</span><span>)</span><span>:</span></div>
856 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
857 <div class="paragraph Code
" style="line-height:
11pt;
">a at(1)</div>
858 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> "</span><span>a
</span><span>"</span></div>
859 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
860 <div class="paragraph Body
" style="line-height:
12pt;
">Note: List indexes begin at zero and nil is returned if the accessed index doesn’t exist.</div>
861 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
862 <div class="paragraph Body
" style="line-height:
12pt;
"><span>S</span><span>et</span><span> the</span><span> item at </span><span>a given index</span><span>:</span></div>
863 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
864 <div class="paragraph Code
" style="line-height:
11pt;
"><span>a atPut(2, "</span><span>foo
</span><span>")</span></div>
865 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> list(</span><span>33</span><span>, "</span><span>a
</span><span>", </span><span>"</span><span>foo
</span><span>", </span><span>"</span><span>b
</span><span>")</span></div>
866 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
867 <div class="paragraph Code
" style="line-height:
11pt;
"><span>a atPut(</span><span>6</span><span>, "Fred
")</span></div>
868 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==></span><span> Exception: index out of bounds</span></div>
869 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
870 <div class="paragraph Body
" style="line-height:
12pt;
">Remove an item at a given index:</div>
871 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
872 <div class="paragraph Code
" style="line-height:
11pt;
">a remove(“foo”)</div>
873 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> list(</span><span>33</span><span>, "</span><span>a
</span><span>"</span><span>, </span><span>"</span><span>b
</span><span>")</span></div>
874 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
875 <div class="paragraph Body
" style="line-height:
12pt;
"><span>Inserting an item at</span><span> a given index</span><span>:</span></div>
876 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
877 <div class="paragraph Code
" style="line-height:
11pt;
"><span>a atPut(2, "</span><span>foo
</span><span>")</span></div>
878 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> list(</span><span>33</span><span>, "</span><span>a
</span><span>", </span><span>"</span><span>foo
</span><span>", </span><span>"</span><span>56</span><span>")</span></div>
879 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
880 <div class="paragraph Heading_2
" style="line-height:
13pt;
">foreach</div>
881 <div class="paragraph Body
" style="line-height:
12pt;
">The foreach, map and select methods can be used in three forms:</div>
882 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
883 <div class="paragraph Code
" style="line-height:
11pt;
"><span>Io> </span><span>a</span><span> := list(</span><span>65, 21, 122</span><span>)</span></div>
884 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
885 <div class="paragraph Body
" style="line-height:
12pt;
"><span>In the first form, the first argument i</span><span>s used as an index variable, the second as a value variable and the 3rd as the expression to evaluate for each value.</span></div>
886 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
887 <div class="paragraph Code
" style="line-height:
11pt;
"><span>Io> </span><span>a</span><span> </span><span>foreach</span><span>(i, v, </span><span>write(i, “:”, v, “, ”)</span><span>)</span></div>
888 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> </span><span>0:65, 1:21, 2:122,</span></div>
889 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
890 <div class="paragraph Body
" style="line-height:
12pt;
">The second form removes the index argument:</div>
891 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
892 <div class="paragraph Code
" style="line-height:
11pt;
"><span>Io> </span><span>a</span><span> foreach(v, </span><span>v</span><span> println)</span></div>
893 <div class="paragraph Code
" style="line-height:
11pt;
">==> 65</div>
894 <div class="paragraph Code
" style="line-height:
11pt;
">21</div>
895 <div class="paragraph Code
" style="line-height:
11pt;
">122</div>
896 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
897 <div class="paragraph Body
" style="line-height:
12pt;
">The third form removes the value argument and simply sends the expression as a message to each value:</div>
898 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
899 <div class="paragraph Code
" style="line-height:
11pt;
"><span>Io> </span><span>a</span><span> foreach(</span><span>println</span><span>)</span></div>
900 <div class="paragraph Code
" style="line-height:
11pt;
">==> 65</div>
901 <div class="paragraph Code
" style="line-height:
11pt;
">21</div>
902 <div class="paragraph Code
" style="line-height:
11pt;
">122</div>
903 <div class="paragraph Heading_2
" style="line-height:
13pt; text-decoration: none;
"> </div>
904 <div class="paragraph Heading_2
" style="line-height:
13pt;
">map and select</div>
905 <div class="paragraph Body
" style="line-height:
12pt;
">Io's map and select (known as filter in some other languages) methods allow arbitrary expressions as the map/select predicates.</div>
906 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
907 <div class="paragraph Code
" style="line-height:
11pt;
">Io> numbers := list(1, 2, 3, 4, 5, 6)</div>
908 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
909 <div class="paragraph Code
" style="line-height:
11pt;
">Io> numbers select(isOdd)</div>
910 <div class="paragraph Code
" style="line-height:
11pt;
">==> list(1, 3, 5)</div>
911 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
912 <div class="paragraph Code
" style="line-height:
11pt;
">Io> numbers select(x, x isOdd)</div>
913 <div class="paragraph Code
" style="line-height:
11pt;
">==> list(1, 3, 5)</div>
914 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
915 <div class="paragraph Code
" style="line-height:
11pt;
">Io> numbers select(i, x, x isOdd)</div>
916 <div class="paragraph Code
" style="line-height:
11pt;
">==> list(1, 3, 5)</div>
917 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
918 <div class="paragraph Code
" style="line-height:
11pt;
">Io> numbers map(x, x*2)</div>
919 <div class="paragraph Code
" style="line-height:
11pt;
">==> list(2, 4, 6, 8, 10, 12)</div>
920 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
921 <div class="paragraph Code
" style="line-height:
11pt;
">Io> numbers map(i, x, x+i)</div>
922 <div class="paragraph Code
" style="line-height:
11pt;
">==> list(1, 3, 5, 7, 9, 11)</div>
923 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
924 <div class="paragraph Code
" style="line-height:
11pt;
">Io> numbers map(*3)</div>
925 <div class="paragraph Code
" style="line-height:
11pt;
">==> list(3, 6, 9, 12, 15, 18)</div>
926 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
927 <div class="paragraph Body
" style="line-height:
12pt;
">The map and select methods return new lists. To do the same operations in-place, you can use selectInPlace() and mapInPlace() methods.</div>
928 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC26083
" id="TOC26083
"></a><span>S</span><span>equence</span></div>
929 <div class="paragraph Body
" style="line-height:
12pt;
"><span>In Io, an immutable Sequence is called a Symbol and a mutable Sequence is the equivalent of a Buffer or String</span><span>. Literal </span><span>strings(ones that appear in source code surrounded by quotes) are Symbols. Mutable operations cannot be performed on Symbols, but one can make mutable copy of a Symbol calling it’s asMutable method and then perform the mutation operations on the copy.</span></div>
930 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Common string operations</div>
931 <div class="paragraph Body
" style="line-height:
12pt;
">Getting the length of a string:</div>
932 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
933 <div class="paragraph Code
" style="line-height:
11pt;
">"abc
" size</div>
934 <div class="paragraph Code
" style="line-height:
11pt;
">==> 3</div>
935 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
936 <div class="paragraph Body
" style="line-height:
12pt;
">Checking if a string contains a substring:</div>
937 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
938 <div class="paragraph Code
" style="line-height:
11pt;
">"apples
" containsSeq("ppl
")</div>
939 <div class="paragraph Code
" style="line-height:
11pt;
">==> true</div>
940 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
941 <div class="paragraph Body
" style="line-height:
12pt;
">Getting the character (byte) at position N:</div>
942 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
943 <div class="paragraph Code
" style="line-height:
11pt;
">"Kavi
" at(1)</div>
944 <div class="paragraph Code
" style="line-height:
11pt;
">==> 97</div>
945 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
946 <div class="paragraph Body
" style="line-height:
12pt;
">Slicing:</div>
947 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
948 <div class="paragraph Code
" style="line-height:
11pt;
">"Kirikuro
" slice(0, 2)</div>
949 <div class="paragraph Code
" style="line-height:
11pt;
">==> "Ki
"</div>
950 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
951 <div class="paragraph Code
" style="line-height:
11pt;
">"Kirikuro
" slice(-2) # NOT: slice(-2, 0)!</div>
952 <div class="paragraph Code
" style="line-height:
11pt;
">==> "ro
"</div>
953 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
954 <div class="paragraph Code
" style="line-height:
11pt;
">Io> "Kirikuro
" slice(0, -2)</div>
955 <div class="paragraph Code
" style="line-height:
11pt;
"># "Kiriku
"</div>
956 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
957 <div class="paragraph Body
" style="line-height:
12pt;
">Stripping whitespace:</div>
958 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
959 <div class="paragraph Code
" style="line-height:
11pt;
"><span>" abc
" </span><span>adMutable </span><span>strip</span></div>
960 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==></span><span> "abc
"</span></div>
961 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
962 <div class="paragraph Code
" style="line-height:
11pt;
"><span>" abc
" asMutable </span><span>l</span><span>strip</span></div>
963 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==></span><span> "abc
</span><span> </span><span>"</span></div>
964 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
965 <div class="paragraph Code
" style="line-height:
11pt;
"><span>"</span><span> </span><span>abc
" asMutable rstrip</span></div>
966 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==></span><span> "</span><span> </span><span>abc
"</span></div>
967 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
968 <div class="paragraph Body
" style="line-height:
12pt;
">Converting to upper/lowercase:</div>
969 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
970 <div class="paragraph Code
" style="line-height:
11pt;
">"Kavi
" asUppercase</div>
971 <div class="paragraph Code
" style="line-height:
11pt;
">==> "KAVI
"</div>
972 <div class="paragraph Code
" style="line-height:
11pt;
">"Kavi
" asLowercase</div>
973 <div class="paragraph Code
" style="line-height:
11pt;
">==> "kavi
"</div>
974 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
975 <div class="paragraph Body
" style="line-height:
12pt;
">Splitting a string:</div>
976 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
977 <div class="paragraph Code
" style="line-height:
11pt;
">"the quick brown fox
" split</div>
978 <div class="paragraph Code
" style="line-height:
11pt;
">==> list("the
", "quick
", "brown
", "fox
")</div>
979 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
980 <div class="paragraph Body
" style="line-height:
12pt;
"><span>S</span><span>plitting by others character is possible as well</span><span>.</span></div>
981 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
982 <div class="paragraph Code
" style="line-height:
11pt;
">"a few good men
" split("e
")</div>
983 <div class="paragraph Code
" style="line-height:
11pt;
">==> list("a f
", "w good m
", "n
")</div>
984 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
985 <div class="paragraph Body
" style="line-height:
12pt;
">Converting to number:</div>
986 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
987 <div class="paragraph Code
" style="line-height:
11pt;
">"13" asNumber</div>
988 <div class="paragraph Code
" style="line-height:
11pt;
">==> 13</div>
989 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
990 <div class="paragraph Code
" style="line-height:
11pt;
">"a13
" asNumber</div>
991 <div class="paragraph Code
" style="line-height:
11pt;
">==> nil</div>
992 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
993 <div class="paragraph Body
" style="line-height:
12pt;
">String interpolation:</div>
994 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
995 <div class="paragraph Code
" style="line-height:
11pt;
">name := "Fred
"</div>
996 <div class="paragraph Code
" style="line-height:
11pt;
">==> Fred</div>
997 <div class="paragraph Code
" style="line-height:
11pt;
">"My name is #{name}
" interpolate</div>
998 <div class="paragraph Code
" style="line-height:
11pt;
">==> My name is Fred</div>
999 <div class="paragraph Body
" style="line-height:
12pt;
"> </div>
1000 <div class="paragraph Body
" style="line-height:
12pt;
"><span>I</span><span>nterpolat</span><span>e will eval anything with #{} as Io code in the local context. The code may include loops or anything else but needs to return an object that responds to asString.</span></div>
1001 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC27607
" id="TOC27607
"></a><span style="font-family: 'Helvetica', 'Arial', 'sans-serif'; line-height:
17pt;
">R</span><span style="font-family: 'Helvetica', 'Arial', 'sans-serif'; line-height:
17pt;
">anges</span></div>
1002 <div class="paragraph Body
" style="line-height:
12pt;
"><span>A range is a container containing a start and an end point, and instructions on how to get from the start, to the end. Using Ranges is often convenient when creating large lists of sequential data as they can be easily converted to lists, or as a replacement for the for() method.</span><span style="font-family: 'Helvetica', 'Arial', 'sans-serif'; line-height:
12pt;
"></span></div>
1003 <div class="paragraph Heading_2
" style="line-height:
13pt;
"><span>The Range protocol</span><span style="font-family: 'Helvetica', 'Arial', 'sans-serif'; line-height:
13pt;
"></span></div>
1004 <div class="paragraph Body
" style="line-height:
12pt;
">Each object that can be used in Ranges needs to implement a "nextInSequence
" method which takes a single optional argument (the number of items to skip in the sequence of objects), and return the next item after that skip value. The default skip value is 1. The skip value of 0 is undefined. An example:</div>
1005 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1006 <div class="paragraph Code
" style="line-height:
11pt;
">Number nextInSequence := method(skipVal,</div>
1007 <div class="paragraph Code
" style="line-height:
11pt;
"> if(skipVal isNil, skipVal = 1)</div>
1008 <div class="paragraph Code
" style="line-height:
11pt;
"> self + skipVal</div>
1009 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
1010 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1011 <div class="paragraph Body
" style="line-height:
12pt;
">With this method on Number (it’s already there in the standard libraries), you can then use Numbers in Ranges, as demonstrated below:</div>
1012 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1013 <div class="paragraph Code
" style="line-height:
11pt;
">1 to(5) foreach(v, v println)</div>
1014 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1015 <div class="paragraph Body
" style="line-height:
12pt;
">The above will print 1 through 5, each on its own line.</div>
1016 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC28533
" id="TOC28533
"></a><span>File</span></div>
1017 <div class="paragraph Body
" style="line-height:
12pt;
">Tthe methods openForAppending, openForReading, or openForUpdating are used for opening files. To erase an existing file before opening a new open, the remove method can be used. Example:</div>
1018 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1019 <div class="paragraph Code
" style="line-height:
11pt;
">f := File with(“foo.txt)</div>
1020 <div class="paragraph Code
" style="line-height:
11pt;
">f remove</div>
1021 <div class="paragraph Code
" style="line-height:
11pt;
"><span>f </span><span>openForUpdating</span></div>
1022 <div class="paragraph Code
" style="line-height:
11pt;
">f write(“hello world!”)</div>
1023 <div class="paragraph Code
" style="line-height:
11pt;
">f close</div>
1024 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC28810
" id="TOC28810
"></a><span>Directory</span></div>
1025 <div class="paragraph Body
" style="line-height:
12pt;
">Creating a directory object:</div>
1026 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1027 <div class="paragraph Code
" style="line-height:
11pt; font-size:
9pt; line-height:
11pt;
">dir := Directory with(“/Users/steve/”)</div>
1028 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1029 <div class="paragraph Body
" style="line-height:
12pt;
">Get a list of file objects for all the files in a directory:</div>
1030 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
1031 <div class="paragraph Code
" style="line-height:
11pt;
">files := dir files</div>
1032 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1033 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> list(File_0x820c40, </span><span>File_0x820c40, ...)</span></div>
1034 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1035 <div class="paragraph Body
" style="line-height:
12pt;
">Get a list of both the file and directory objects in a directory:</div>
1036 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1037 <div class="paragraph Code
" style="line-height:
11pt;
">items := Directory items</div>
1038 <div class="paragraph Code
" style="line-height:
11pt;
"><span>==> list(Directory_0x8446b0, </span><span>File_0x820c40, ...)</span></div>
1039 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1040 <div class="paragraph Code
" style="line-height:
11pt;
">items at(4) name</div>
1041 <div class="paragraph Code
" style="line-height:
11pt;
">==> DarkSide-0.0.1 # a directory name</div>
1042 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1043 <div class="paragraph Body
" style="line-height:
12pt;
">Setting a Directory object to a certain directory and using it:</div>
1044 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1045 <div class="paragraph Code
" style="line-height:
11pt;
">root := Directory clone setPath("c:/
")</div>
1046 <div class="paragraph Code
" style="line-height:
11pt;
">==> Directory_0x8637b8</div>
1047 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
1048 <div class="paragraph Code
" style="line-height:
11pt;
">root fileNames</div>
1049 <div class="paragraph Code
" style="line-height:
11pt;
">==> list("AUTOEXEC.BAT
", "boot.ini
", "CONFIG.SYS
", ...)</div>
1050 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1051 <div class="paragraph Body
" style="line-height:
12pt;
">Testing for existance:</div>
1052 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1053 <div class="paragraph Code
" style="line-height:
11pt;
">Directory clone setPath("q:/
") exists</div>
1054 <div class="paragraph Code
" style="line-height:
11pt;
">==> false</div>
1055 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1056 <div class="paragraph Body
" style="line-height:
12pt;
">Getthing the current working directory:</div>
1057 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1058 <div class="paragraph Code
" style="line-height:
11pt;
">Directory currentWorkingDirectory</div>
1059 <div class="paragraph Code
" style="line-height:
11pt;
">==> “/cygdrive/c/lang/IoFull-Cygwin-2006-04-20”</div>
1060 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC29611
" id="TOC29611
"></a><span>Date</span></div>
1061 <div class="paragraph Body
" style="line-height:
12pt;
">Creating a new date instance:</div>
1062 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1063 <div class="paragraph Code
" style="line-height:
11pt;
">d := Date clone</div>
1064 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1065 <div class="paragraph Body
" style="line-height:
12pt;
">Setting it to the current date/time:</div>
1066 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1067 <div class="paragraph Code
" style="line-height:
11pt;
">d now</div>
1068 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1069 <div class="paragraph Body
" style="line-height:
12pt;
">Getting the date/time as a number, in seconds:</div>
1070 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1071 <div class="paragraph Code
" style="line-height:
11pt;
">Date now asNumber</div>
1072 <div class="paragraph Code
" style="line-height:
11pt;
">==> 1147198509.417114</div>
1073 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1074 <div class="paragraph Code
" style="line-height:
11pt;
">Date now asNumber</div>
1075 <div class="paragraph Code
" style="line-height:
11pt;
">==> 1147198512.33313</div>
1076 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1077 <div class="paragraph Body
" style="line-height:
12pt;
">Getting individual parts of a Date object:</div>
1078 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1079 <div class="paragraph Code
" style="line-height:
11pt;
">d := Date now</div>
1080 <div class="paragraph Code
" style="line-height:
11pt;
">==> 2006-05-09 21:53:03 EST</div>
1081 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1082 <div class="paragraph Code
" style="line-height:
11pt;
">d</div>
1083 <div class="paragraph Code
" style="line-height:
11pt;
">==> 2006-05-09 21:53:03 EST</div>
1084 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1085 <div class="paragraph Code
" style="line-height:
11pt;
">d year</div>
1086 <div class="paragraph Code
" style="line-height:
11pt;
">==> 2006</div>
1087 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1088 <div class="paragraph Code
" style="line-height:
11pt;
">d month</div>
1089 <div class="paragraph Code
" style="line-height:
11pt;
">==> 5</div>
1090 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1091 <div class="paragraph Code
" style="line-height:
11pt;
">d day</div>
1092 <div class="paragraph Code
" style="line-height:
11pt;
">==> 9</div>
1093 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1094 <div class="paragraph Code
" style="line-height:
11pt;
">d hour</div>
1095 <div class="paragraph Code
" style="line-height:
11pt;
">==> 21</div>
1096 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1097 <div class="paragraph Code
" style="line-height:
11pt;
">d minute</div>
1098 <div class="paragraph Code
" style="line-height:
11pt;
">==> 53</div>
1099 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1100 <div class="paragraph Code
" style="line-height:
11pt;
">d second</div>
1101 <div class="paragraph Code
" style="line-height:
11pt;
">==> 3.747125</div>
1102 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1103 <div class="paragraph Body
" style="line-height:
12pt;
">Find how long it takes to execute some code:</div>
1104 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1105 <div class="paragraph Code
" style="line-height:
11pt;
">Date cpuSecondsToRun(100000 repeat(1+1))</div>
1106 <div class="paragraph Code
" style="line-height:
11pt;
">==> 0.02</div>
1107 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1108 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1111 <div><div class="layout_style_13
"><div class="paragraph
"></div>
1112 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt; text-decoration: none;
"> </div>
1113 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC30156
" id="TOC30156
"></a><span>Networking</span></div>
1114 <div class="paragraph Body
" style="line-height:
12pt;
">All of Io’s networking is done with asynchronous sockets underneath, but operations like reading and writing to a socket appear to be synchronous since the calling coroutine is unscheduled until the socket has completed the operation, or a timeout occurs. Note that you’ll need to first reference the associated addon in order to cause it to load before using it’s objects. In these examples, you’ll have to reference “Socket” to get the Socket addon to load first.</div>
1115 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1116 <div class="paragraph Body
" style="line-height:
12pt;
"><span>Creating a </span><span>URL</span><span> object:</span></div>
1117 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1118 <div class="paragraph Code
" style="line-height:
11pt;
">url := URL with("http://example.com/
")</div>
1119 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1120 <div class="paragraph Body
" style="line-height:
12pt;
">Fetching an URL:</div>
1121 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1122 <div class="paragraph Code
" style="line-height:
11pt;
">data := url fetch </div>
1123 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
1124 <div class="paragraph Body
" style="line-height:
12pt;
">Streaming a URL to a file:</div>
1125 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1126 <div class="paragraph Code
" style="line-height:
11pt;
"><span>url streamTo(</span><span>File with("out.txt
")</span><span>)</span></div>
1127 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1128 <div class="paragraph Body
" style="line-height:
12pt;
">A simple whois client:</div>
1129 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1130 <div class="paragraph Code
" style="line-height:
11pt;
">whois := method(host,</div>
1131 <div class="paragraph Code
" style="line-height:
11pt;
"> socket := Socket clone setHostName("rs.internic.net
") setPort(43) </div>
1132 <div class="paragraph Code
" style="line-height:
11pt;
"> socket connect streamWrite(host, "\n
")</div>
1133 <div class="paragraph Code
" style="line-height:
11pt;
"> while(socket streamReadNextChunk, nil)</div>
1134 <div class="paragraph Code
" style="line-height:
11pt;
"> return socket readBuffer</div>
1135 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
1136 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1137 <div class="paragraph Body
" style="line-height:
12pt;
">A minimal web server:</div>
1138 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1139 <div class="paragraph Code
" style="line-height:
11pt;
">WebRequest := Object clone do(</div>
1140 <div class="paragraph Code
" style="line-height:
11pt;
"> handleSocket := method(aSocket,</div>
1141 <div class="paragraph Code
" style="line-height:
11pt;
"> aSocket streamReadNextChunk</div>
1142 <div class="paragraph Code
" style="line-height:
11pt;
"> request := aSocket readBuffer betweenSeq("GET
", " HTTP
")</div>
1143 <div class="paragraph Code
" style="line-height:
11pt;
"> f := File with(request) </div>
1144 <div class="paragraph Code
" style="line-height:
11pt;
"> if(f exists, f streamTo(aSocket), aSocket streamWrite("not found
"))</div>
1145 <div class="paragraph Code
" style="line-height:
11pt;
"> aSocket close</div>
1146 <div class="paragraph Code
" style="line-height:
11pt;
"> )</div>
1147 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
1148 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
1149 <div class="paragraph Code
" style="line-height:
11pt;
">WebServer := Server clone do(</div>
1150 <div class="paragraph Code
" style="line-height:
11pt;
"> setPort(8000)</div>
1151 <div class="paragraph Code
" style="line-height:
11pt;
"> handleSocket := method(aSocket, </div>
1152 <div class="paragraph Code
" style="line-height:
11pt;
"> WebRequest clone @handleSocket(aSocket)</div>
1153 <div class="paragraph Code
" style="line-height:
11pt;
"> )</div>
1154 <div class="paragraph Code
" style="line-height:
11pt;
">)</div>
1155 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
1156 <div class="paragraph Code
" style="line-height:
11pt;
">WebServer start</div>
1157 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC31463
" id="TOC31463
"></a><span>XML</span></div>
1158 <div class="paragraph Body
" style="line-height:
12pt;
">Using the XML parser to find the links in a web page:</div>
1159 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1160 <div class="paragraph Code
" style="line-height:
11pt;
"><span style="font-family: 'Courier', 'serif'; line-height:
11pt;
">xml := URL with("http://www.yahoo.com/
") fetch </span><span>asXML</span></div>
1161 <div class="paragraph Code
" style="line-height:
11pt; font-family: 'Courier', 'serif'; line-height:
11pt;
">links := xml elementsWithName("a
") map(attributes at("href
"))</div>
1162 <div class="paragraph Heading_1
" style="line-height:
17pt; text-decoration: none;
"> </div>
1163 <div class="paragraph Heading_1
" style="line-height:
17pt; text-decoration: none;
"> </div>
1164 <div class="paragraph Body
" style="line-height:
12pt;
"></div>
1165 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1166 <div class="paragraph Heading
" style="line-height:
29pt;
"><a name="TOC31641
" id="TOC31641
"></a><span>Embedding</span></div>
1167 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC31651
" id="TOC31651
"></a><span>Coding Conventions</span></div>
1168 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Io’s C code is written using object oriented style conventions where structures are treated as objects and functions as methods. Familiarity with these may help make the embedding APIs easier to understand.</div>
1169 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Structures</div>
1170 <div class="paragraph Body
" style="line-height:
12pt;
">Member names are words that begin with a lower case character with successive words each having their first character upper cased. Acronyms are capitalized. Structure names are words with their first character capitalized.</div>
1171 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1172 <div class="paragraph Body
" style="line-height:
12pt;
">Example:</div>
1173 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1174 <div class="paragraph Code
" style="line-height:
11pt;
">typdef struct </div>
1175 <div class="paragraph Code
" style="line-height:
11pt;
">{</div>
1176 <div class="paragraph Code
" style="line-height:
11pt;
"> char *firstName;</div>
1177 <div class="paragraph Code
" style="line-height:
11pt;
"> char *lastName;</div>
1178 <div class="paragraph Code
" style="line-height:
11pt;
"> char *address;</div>
1179 <div class="paragraph Code
" style="line-height:
11pt;
">} Person;</div>
1180 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Functions</div>
1181 <div class="paragraph Body
" style="line-height:
12pt;
">Function names begin with the name of structure they operate on followed by an underscore and the method name. Each structure has a new and free function.</div>
1182 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1183 <div class="paragraph Body
" style="line-height:
12pt;
">Example:</div>
1184 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1185 <div class="paragraph Code
" style="line-height:
11pt;
">List *List_new(void);</div>
1186 <div class="paragraph Code
" style="line-height:
11pt;
">void List_free(List *self);</div>
1187 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1188 <div class="paragraph Body
" style="line-height:
12pt;
">All methods (except new) have the structure (the "object
") as the first argument the variable is named "self
". Method names are in keyword format. That is, for each argument, the method name has a description followed by an underscore. The casing of the descriptions follow that of structure member names.</div>
1189 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1190 <div class="paragraph Body
" style="line-height:
12pt;
">Examples:</div>
1191 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1192 <div class="paragraph Code
" style="line-height:
11pt;
">int List_count(List *self); /* no argument */</div>
1193 <div class="paragraph Code
" style="line-height:
11pt;
">void List_add_(List *self, void *item); /* one argument */</div>
1194 <div class="paragraph Code
" style="line-height:
11pt;
">void Dictionary_key_value_(Dictionary *self, char *key, char *value); </div>
1195 <div class="paragraph Heading_2
" style="line-height:
13pt;
">File Names</div>
1196 <div class="paragraph Body
" style="line-height:
12pt;
">Each structure has it's own separate .h and .c files. The names of the files are the same as the name of the structure. These files contain all the functions(methods) that operate on the given structure.</div>
1197 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1198 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1201 <div><div class="layout_style_14
"><div class="paragraph
"></div>
1202 <div class="paragraph Heading_1
" style="line-height:
17pt; padding-top:
0pt; text-decoration: none;
"> </div>
1203 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC33140
" id="TOC33140
"></a><span>IoState</span></div>
1204 <div class="paragraph Body
" style="line-height:
12pt;
">An IoState can be thought of as an instance of an Io “virtual machine”, although “virtual machine” is a less appropriate term because it implies a particular type of implementation. </div>
1205 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Multiple states</div>
1206 <div class="paragraph Body
" style="line-height:
12pt;
">Io is multi-state, meaning that it is designed to support multiple state instances within the same process. These instances are isolated and share no memory so they can be safely accessed simultaneously by different os threads, though a given state should only be accessed by one os thread at a time.</div>
1207 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Creating a state</div>
1208 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">Here’s a simple example of creating a state, evaluating a string in it, and freeing the state:</div>
1209 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
1210 <div class="paragraph Code
" style="line-height:
11pt;
">#include "IoState.h
"</div>
1211 <div class="paragraph Code
" style="line-height:
11pt; text-decoration: none;
"> </div>
1212 <div class="paragraph Code
" style="line-height:
11pt;
">int main(int argc, const char *argv[])</div>
1213 <div class="paragraph Code
" style="line-height:
11pt;
">{</div>
1214 <div class="paragraph Code
" style="line-height:
11pt;
"> IoState *self = IoState_new();</div>
1215 <div class="paragraph Code
" style="line-height:
11pt;
"> IoState_init(self);</div>
1216 <div class="paragraph Code
" style="line-height:
11pt;
"> IoState_doCString_(self, “writeln(\”hello world!\””);</div>
1217 <div class="paragraph Code
" style="line-height:
11pt;
"> IoState_free(self);</div>
1218 <div class="paragraph Code
" style="line-height:
11pt;
"> return 0;</div>
1219 <div class="paragraph Code
" style="line-height:
11pt;
">}</div>
1220 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC33966
" id="TOC33966
"></a><span>Values</span></div>
1221 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">We can also get return values and look at their types and print them:</div>
1222 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
1223 <div class="paragraph Code
" style="line-height:
11pt;
">IoObject *v = IoState_doCString_(self, someString);</div>
1224 <div class="paragraph Code
" style="line-height:
11pt;
">char *name = IoObject_name(v);</div>
1225 <div class="paragraph Code
" style="line-height:
11pt;
">printf(“return type is a ‘%s’, name);</div>
1226 <div class="paragraph Code
" style="line-height:
11pt;
">IoObject_print(v);</div>
1227 <div class="paragraph Heading_2
" style="line-height:
13pt;
">Checking value types</div>
1228 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt;
">There are some macro short cuts to help with quick type checks:</div>
1229 <div class="paragraph Body
" style="line-height:
12pt; margin-bottom:
0pt; margin-left:
72pt; margin-top:
0pt; text-indent:
0pt; line-height:
12pt; text-decoration: none;
"> </div>
1230 <div class="paragraph Code
" style="line-height:
11pt;
">if (ISNUMBER(v))</div>
1231 <div class="paragraph Code
" style="line-height:
11pt;
">{</div>
1232 <div class="paragraph Code
" style="line-height:
11pt;
"> printf(“result is the number %f”, IoNumber_asFloat(v));</div>
1233 <div class="paragraph Code
" style="line-height:
11pt;
">} </div>
1234 <div class="paragraph Code
" style="line-height:
11pt;
">else if(ISSEQ(v))</div>
1235 <div class="paragraph Code
" style="line-height:
11pt;
">{</div>
1236 <div class="paragraph Code
" style="line-height:
11pt;
"> printf(“result is the string %s”, IoSeq_asCString(v));</div>
1237 <div class="paragraph Code
" style="line-height:
11pt;
">}</div>
1238 <div class="paragraph Code
" style="line-height:
11pt;
">else if(ISLIST(v))</div>
1239 <div class="paragraph Code
" style="line-height:
11pt;
">{</div>
1240 <div class="paragraph Code
" style="line-height:
11pt;
"> printf(“result is a list with %i elements”, IoList_rawSize(v));</div>
1241 <div class="paragraph Code
" style="line-height:
11pt;
">}</div>
1242 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1243 <div class="paragraph Body
" style="line-height:
12pt;
">Note that return values are always proper Io objects (as all values are objects in Io). You can find the C level methods (functions like IoList_rawSize()) for these objects in the header files in the folder Io/libs/iovm/source. </div>
1244 <div class="paragraph Heading_1
" style="line-height:
17pt; text-decoration: none;
"> </div>
1245 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC34746
" id="TOC34746
"></a><span>Bindings</span></div>
1246 <div class="paragraph Body
" style="line-height:
12pt;
">forthcoming..</div>
1247 <div class="paragraph Body
" style="line-height:
12pt; text-decoration: none;
"> </div>
1248 <div class="paragraph Heading
" style="line-height:
29pt; margin-bottom:
0pt; margin-top:
0pt; padding-bottom:
3pt;
"><a name="TOC34770
" style="line-height:
29pt;
" id="TOC34770
"></a><span style="line-height:
29pt;
">Appendix</span></div>
1249 <div class="paragraph Heading_1
" style="line-height:
17pt;
"></div>
1250 <div class="paragraph Heading_1
" style="line-height:
17pt;
"><a name="TOC34780
" id="TOC34780
"></a><span>Grammar</span><span style="font-size:
8pt; line-height:
10pt;
"></span></div>
1251 <div class="paragraph Heading_2
" style="line-height:
13pt;
">messages</div>
1252 <div class="paragraph Code
" style="line-height:
11pt; font-size:
10pt; line-height:
12pt;
">expression ::= { message | sctpad }</div>
1253 <div class="paragraph Code
" style="line-height:
11pt; font-size:
10pt; line-height:
12pt;
">message ::= [wcpad] symbol [scpad] [arguments]</div>
1254 <div class="paragraph Code
" style="line-height:
11pt; font-size:
10pt; line-height:
12pt;
">arguments ::= Open [argument [ { Comma argument } ]] Close</div>
1255 <div class="paragraph Code
" style="line-height:
11pt;
"><span style="font-size:
10pt; line-height:
12pt;
">argument ::= [wcpad] expression [wcpad]</span><span style="font-family: 'ArialMT', 'Arial', 'sans-serif'; font-size:
10pt; line-height:
11pt;
"></span></div>
1256 <div class="paragraph Heading_2
" style="line-height:
13pt;
">symbols</div>
1257 <div class="paragraph Code
" style="line-height:
11pt; font-size:
10pt; line-height:
12pt;
">symbol ::= Identifier | number | Operator | quote</div>
1258 <div class="paragraph Code
" style="line-height:
11pt;
">Identifier ::= { letter | digit | "_
" }</div>
1259 <div class="paragraph Code
" style="line-height:
11pt;
">Operator ::= { “:” | ".
" | "'
" | "~
" | "!
" | "@
" | "$
" | "%
" | "^
" | "&" | "*
" | "-
" | "+
" | "/
" | "=
" | "{
" | "}
" | "[
" | "]
" | "|
" | "\
" | "<" | ">" | "?
" }</div>
1260 <div class="paragraph Heading_2
" style="line-height:
13pt;
">quotes</div>
1261 <div class="paragraph Code
" style="line-height:
11pt; font-size:
10pt; line-height:
12pt;
">quote ::= MonoQuote | TriQuote</div>
1262 <div class="paragraph Code
" style="line-height:
11pt; font-size:
10pt; line-height:
12pt;
">MonoQuote ::= """ [
"\"" | not(""")]
"""</div>
1263 <div class="paragraph Code
" style="line-height:
11pt;
"><span style="font-size:
10pt; line-height:
12pt;
">TriQuote ::= """"" [ not(
""""")] """""</span><span style=
"font-family: 'ArialMT', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 11pt; "></span></div>
1264 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">spans
</div>
1265 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">Terminator ::= { [seperator]
";" |
"\n" |
"\r" [seperator] }
</div>
1266 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">seperator ::= {
" " |
"\f" |
"\t" |
"\v" }
</div>
1267 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">whitespace ::= {
" " |
"\f" |
"\r" |
"\t" |
"\v" |
"\n" }
</div>
1268 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">sctpad ::= { separator | Comment | Terminator }
</div>
1269 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">scpad ::= { separator | Comment }
</div>
1270 <div class=
"paragraph Code" style=
"line-height: 11pt; "><span style=
"font-size: 10pt; line-height: 12pt; ">wcpad ::= { whitespace | Comment }
</span><span style=
"font-family: 'ArialMT', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 11pt; "></span></div>
1271 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">comments
</div>
1272 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">Comment ::= slashStarComment | slashSlashComment | poundComment
</div>
1273 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">slashStarComment ::=
"/*" [not(
"*/")]
"*/"</div>
1274 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">slashSlashComment ::=
"//" [not(
"\n")]
"\n"</div>
1275 <div class=
"paragraph Code" style=
"line-height: 11pt; "><span style=
"font-size: 10pt; line-height: 12pt; ">poundComment ::=
"#" [not(
"\n")]
"\n"</span><span style=
"font-family: 'ArialMT', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 11pt; "></span></div>
1276 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">numbers
</div>
1277 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">number ::= HexNumber | Decimal
</div>
1278 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">HexNumber ::=
"0" anyCase(
"x") { [ digit | hexLetter ] }
</div>
1279 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">hexLetter ::=
"a" |
"b" |
"c" |
"d" |
"e" |
"f"</div>
1280 <div class=
"paragraph Code" style=
"line-height: 11pt; "><span style=
"font-size: 10pt; line-height: 12pt; ">Decimal ::= digits |
"." digits | digits
"." digits [
"e" [-] digits]
</span><span style=
"font-family: 'ArialMT', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 11pt; "></span></div>
1281 <div class=
"paragraph Heading_2" style=
"line-height: 13pt; ">characters
</div>
1282 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">Comma ::=
","</div>
1283 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">Open ::=
"(" |
"[" |
"{"</div>
1284 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">Close ::=
")" |
"]" |
"}"</div>
1285 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">letter ::=
"a" ...
"z" |
"A" ...
"Z"</div>
1286 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">digit ::=
"0" ...
"9"</div>
1287 <div class=
"paragraph Code" style=
"line-height: 11pt; font-size: 10pt; line-height: 12pt;">digits ::= { digit }
</div>
1288 <div class=
"paragraph Body" style=
"line-height: 12pt; font-family: 'ArialMT', 'Arial', 'sans-serif'; line-height: 11pt; text-decoration: none;"> </div>
1289 <div class=
"paragraph Body" style=
"line-height: 12pt; "></div>
1290 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
1291 <div class=
"paragraph Heading" style=
"line-height: 29pt; "><a name=
"TOC36209" id=
"TOC36209"></a><span>Credits
</span></div>
1292 <div class=
"paragraph Body" style=
"line-height: 12pt; ">Io is the product of all the talented folks who taken the time and interest to make a contribution. The complete list of contributors is difficult to keep track of, but some of the recent major contributors include; Jonathan Wright, Jeremy Tregunna, Mike Austin, Chris Double, Oliver Ansaldi, Baptist Heyman, Ken Kerahone, Christian Thater, Brian Mitchell, Zachary Bir and many more. The mailing list archives, repo inventory and release history are probably the best sources for a more complete record of individual contributions.
</div>
1293 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
1294 <div class=
"paragraph Heading" style=
"line-height: 29pt; "><a name=
"TOC36750" id=
"TOC36750"></a><span>References
</span></div>
1295 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 72pt; margin-top: 0pt; text-indent: 0pt; line-height: 12pt; text-decoration: none;"> </div>
1296 <div class=
"paragraph Body" style=
"line-height: 12pt; "><table cellspacing=
"0" cellpadding=
"0" style=
"background: transparent; border-collapse: collapse; height: 286pt; width: 375pt; word-wrap: break-word; " id=
"id4"><tr><td style=
"background: transparent; border: 1pt #bfbfbf none; height: 284pt; width: 16pt; "><div><div style=
"margin: 5pt; width: 16pt; "><div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt;">1</div>
1297 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1298 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1299 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1300 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt;">2</div>
1301 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1302 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1303 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1304 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt;">3</div>
1305 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1306 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1307 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1308 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt;">4</div>
1309 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1310 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1311 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1312 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt;">5</div>
1313 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1314 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1315 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt; text-decoration: none;"> </div>
1316 <div class=
"paragraph Body" style=
"line-height: 12pt; margin-bottom: 0pt; margin-left: 0pt; margin-top: 0pt; padding-bottom: 0pt; text-indent: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; font-style: normal; font-weight: normal; line-height: 12pt;">6</div>
1320 <td style=
"background: transparent; border: 1pt #bfbfbf none; height: 284pt; width: 357pt; "><div><div style=
"margin: 5pt; width: 357pt; "><div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; padding-top: 0pt; line-height: 12pt;">Goldberg, A et al.
</div>
1321 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Smalltalk-
80: The Language and Its Implementation
</div>
1322 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Addison-Wesley,
1983</div>
1323 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt; text-decoration: none;"> </div>
1324 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Ungar, D and Smith,
</div>
1325 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">RB. Self: The Power of Simplicity
</div>
1326 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">OOPSLA,
1987</div>
1327 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt; text-decoration: none;"> </div>
1328 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Smith, W.
</div>
1329 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Class-based NewtonScript Programming
</div>
1330 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">PIE Developers magazine, Jan
1994</div>
1331 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt; text-decoration: none;"> </div>
1332 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Lieberman
</div>
1333 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">H. Concurrent Object-Oriented Programming in Act
1</div>
1334 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">MIT AI Lab,
1987</div>
1335 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt; text-decoration: none;"> </div>
1336 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">McCarthy, J et al.
</div>
1337 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">LISP I programmer's manual
</div>
1338 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">MIT Press,
1960</div>
1339 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt; text-decoration: none;"> </div>
1340 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Ierusalimschy, R, et al.
</div>
1341 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">Lua: an extensible extension language
</div>
1342 <div class=
"paragraph Footnote_Text" style=
"line-height: 12pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 12pt;">John Wiley
& Sons,
1996</div>
1349 <div class=
"paragraph Body" style=
"line-height: 12pt; text-decoration: none;"> </div>
1350 <div class=
"paragraph Heading" style=
"line-height: 29pt; "></div>
1351 <div class=
"paragraph Heading" style=
"line-height: 29pt; "><a name=
"TOC36766" id=
"TOC36766"></a><span>License
</span></div>
1352 <div class=
"paragraph Body" style=
"line-height: 12pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 12pt;">Copyright
2006 Steve Dekorte. All rights reserved.
</div>
1353 <div class=
"paragraph Body" style=
"line-height: 12pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 12pt; text-decoration: none;"> </div>
1354 <div class=
"paragraph Body" style=
"line-height: 12pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 12pt;">Redistribution and use of this document with or without modification, are permitted provided that the copies reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
</div>
1355 <div class=
"paragraph Body" style=
"line-height: 12pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 12pt; text-decoration: none;"> </div>
1356 <div class=
"paragraph Body" style=
"line-height: 12pt; padding-bottom: 0pt; font-family: 'Helvetica', 'Arial', 'sans-serif'; font-size: 10pt; line-height: 12pt;">This documentation is provided
"as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the Io documentation project be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this documentation, even if advised of the possibility of such damage.
</div>