WIT language preview
1. World with import and export
package version, kebab-case paths, and func signatures
horizon-dark
package example:host@0.1.0;
world hello {
import wasi:io/poll;
export greet: func(name: string) -> string;
} atom-one-dark
package example:host@0.1.0;
world hello {
import wasi:io/poll;
export greet: func(name: string) -> string;
} github-dark
package example:host@0.1.0;
world hello {
import wasi:io/poll;
export greet: func(name: string) -> string;
} dracula
package example:host@0.1.0;
world hello {
import wasi:io/poll;
export greet: func(name: string) -> string;
} nord
package example:host@0.1.0;
world hello {
import wasi:io/poll;
export greet: func(name: string) -> string;
} github
package example:host@0.1.0;
world hello {
import wasi:io/poll;
export greet: func(name: string) -> string;
} 2. Records and variants
interface types with list and kebab-case cases
horizon-dark
interface types {
record person { name: string, age: u32 }
variant error { not-found, other(string) }
type names = list<string>;
} atom-one-dark
interface types {
record person { name: string, age: u32 }
variant error { not-found, other(string) }
type names = list<string>;
} github-dark
interface types {
record person { name: string, age: u32 }
variant error { not-found, other(string) }
type names = list<string>;
} dracula
interface types {
record person { name: string, age: u32 }
variant error { not-found, other(string) }
type names = list<string>;
} nord
interface types {
record person { name: string, age: u32 }
variant error { not-found, other(string) }
type names = list<string>;
} github
interface types {
record person { name: string, age: u32 }
variant error { not-found, other(string) }
type names = list<string>;
} 3. Resource methods
comments and resource constructors
horizon-dark
// file handle
interface files {
resource descriptor {
constructor(path: string);
read: func() -> list<u8>;
}
} atom-one-dark
// file handle
interface files {
resource descriptor {
constructor(path: string);
read: func() -> list<u8>;
}
} github-dark
// file handle
interface files {
resource descriptor {
constructor(path: string);
read: func() -> list<u8>;
}
} dracula
// file handle
interface files {
resource descriptor {
constructor(path: string);
read: func() -> list<u8>;
}
} nord
// file handle
interface files {
resource descriptor {
constructor(path: string);
read: func() -> list<u8>;
}
} github
// file handle
interface files {
resource descriptor {
constructor(path: string);
read: func() -> list<u8>;
}
}