100 Helloslanguages
Home / Languages / Io

Io

2002fraglet
general-purposeprototype-basedobject-oriented.io
docker run --rm --platform="linux/amd64" 100hellos/io:latest

MCP + fragletc

MCPstdinargs
This language supports code execution via MCP and the fragletc CLI. Stdin piping and argument passing are both supported.
Install fragletc →

As a part of the journey of progressing through Seven Languages in Seven Weeks, meet Io -- the Ferris Bueller of programming languages. One of the boons of Io is it's rich concurrency model -- however because this is an alpine based image (which uses musl) and there are some core assumptions in Io around using glibc (in particular, ucontext.h) -- Io has to run with gcompat to provide a glibc compatibility layer and is installed from the provided debian package instead of building from source.

Hello World

#!/usr/bin/env io

"Hello World!" println

Coding Guide

Language Version

Io (latest from Debian package)

Execution Model

  • Interpreted, runs directly from source
  • Top-level code executes immediately
  • No explicit main function required
  • Message-based: everything is a message to an object

Key Characteristics

  • Prototype-based object-oriented language
  • Everything is an object
  • Dynamic typing
  • Case-sensitive
  • Minimal syntax - messages are sent to objects
  • Slots are used for object attributes and methods

Fragment Authoring

Write valid Io statements. Your fragment becomes the script body. Code executes at the top level, so messages are sent immediately in order. Use println or print for output.

Available Packages

Standard Io libraries are available. The language includes built-in support for:

  • Object manipulation
  • Lists and maps
  • File I/O
  • Networking
  • Concurrency (actors, futures, coroutines)

Common Patterns

  • Print: "message" println or "message" print
  • String concatenation: "Hello, " .. "World" println
  • Lists: list(1, 2, 3)
  • Maps: Map clone atPut("key", "value")
  • Methods: method(arg1, arg2, ...)
  • Object creation: Object clone
  • Slot assignment: obj slot := value
  • Message passing: object message(arguments)

Examples

# Simple output
"Hello, World!" println

# Variable assignment and output
name := "Alice"
("Hello, " .. name .. "!") println

# List processing
numbers := list(1, 2, 3, 4, 5)
squared := numbers map(x, x * x)
sum := squared sum
("Sum of squares: " .. sum) println

# Method definition
greet := method(name,
  result := "Hello, " .. name .. "!"
  result println
)
greet("Bob")

# Object creation
Person := Object clone
Person name := ""
Person greet := method(
  ("Hello, I'm " .. self name) println
)
person := Person clone
person name := "Charlie"
person greet

Caveats

  • Io uses message passing - everything is a message
  • Slots must be assigned before use (or use ? for optional)
  • Lists are 0-indexed
  • String concatenation uses .. operator
  • Method definitions use method(...) syntax
  • Prototype-based: objects clone from prototypes

Fraglet Scripts

Echo Args

#!/usr/bin/env -S fragletc --vein=io
write("Args:")
System args rest foreach(arg, write(" " .. arg))
writeln

Stdin Upper

#!/usr/bin/env -S fragletc --vein=io
loop(
  line := File standardInput readLine
  if(line isNil, break)
  line asUppercase println
)

Test

#!/usr/bin/env -S fragletc --vein=io

"Hello World!" println

Connections

influenced by

Container Info

image100hellos/io:latest
build scheduleFriday
fragletenabled
sourceio/files/