iyi

Playground · Basics · 3 of 33

exports

import x::{...}: bring a module's exported names in, unqualified.

samples/tour/exports.iyi · exports.wasm · 121 KB
# `import x::{...}`: bring a module's exported names in, unqualified.

# The whole surface with `::*`, or a chosen few in braces. Either way it is
# this file that asks: a library cannot put names into a file that did not.
import geometry/point::{Point, distance}

home = Point.new(0, 0)
work = Point.new(3, 4)
puts distance(home, work)

# `secret` was declared without `pub`, so it is not there to be found.
# Uncomment the next line to see the compiler say so:
# puts Geometry::Point.secret
output
Press Run.

recorded with iyi 0.18.0 (built on Crystal 1.22.0-dev [2a9653052] (2026-10-18)) · Linux 7.0.0-38-generic x86_64, QEMU Virtual CPU version 2.5+ · 2026-10-19

You can type in the pane: nothing here compiles, so what you type cannot run, and the page says which bytes it is running the moment the text stops being the recorded file. There is no standard input, no filesystem and no threads on this target, and one sample fails on purpose for exactly that reason.

Run executes exports.wasm, the module the compiler built from this file, in your browser. How this works

Try it on your machine

Copy the program into exports.iyi, change something, and run it. Only a compiler on your own machine can run what you wrote.

sh, after installing
$ iyi run exports.iyi