Skip to content

Editing this Documentation

Guides lead a user through a specific task they want to accomplish, often with a sequence of steps. Writing a good guide requires thinking about what your users are trying to do.

Further reading: how-to guides in the Diátaxis framework

Reference pages are ideal for outlining how things work in terse and clear terms. Less concerned with telling a story or addressing a specific use case, they should give a comprehensive outline of what you’re documenting.

Further reading: reference pages in the Diátaxis framework

public fun main() {
print("Hello, World!")
}
src/main.hylo
public fun main() {
print("Hello, World!")
}

No frame:

echo "Command without frame"

With frame (default):

Terminal window
echo "This terminal frame has no title"

With title:

PowerShell terminal example
Write-Output "This one has a title!"

No wrapping (default):

Terminal window
cmake -D LLVM_DIR=<LLVM>/lib/cmake/llvm -D CMAKE_BUILD_TYPE=<build-type> -D BUILD_TESTING=1 -G Ninja -S . -B .build

Wrap:

Terminal window
cmake -D LLVM_DIR=<LLVM>/lib/cmake/llvm -D CMAKE_BUILD_TYPE=<build-type> -D BUILD_TESTING=1 -G Ninja -S . -B .build

Hanging indent:

Terminal window
cmake -D LLVM_DIR=<LLVM>/lib/cmake/llvm -D CMAKE_BUILD_TYPE=<build-type> -D BUILD_TESTING=1 -G Ninja -S . -B .build
internal type SpawnFrame<E: Movable & Deinitializable>: Deinitializable {
/// The base frame object needed by the underlying implementation.
private var base_frame: SpawnFrameBase
/// What needs to be called to produce the value in the future.
private var f: [E]() -> Int
/// The result of the computation.
private var r: Optional<Int>
/// Initializes `self` with `f`, and spawns the computation.
internal init(_ f: sink [E]() -> Int) {
&self.base_frame = .new()
&self.f = f
&self.r = .none()
let local_f = fun (_ frame: inout SpawnFrameBase) -> Void {
var this = PointerToMutable<Self>(type_punning: mutable_pointer[to: &frame])
&this.unsafe[].r = this.unsafe[].f() as _
}
concore2full_spawn2(&self.base_frame, local_f)
}
/// Awaits the result of the computation.
///
/// - Note: May return on a different OS thread than the one that called this.
internal fun await() inout -> Int {
concore2full_await(self.base_frame)
if let r: Int = self.r {
let copy = r.copy()
&self.r = .none()
return copy
} else {
fatal_error()
}
}
/// Allocate an object of `Self` on the heap and initialize it with `f`.
internal static fun allocate(_ f: sink [E]() -> Int) -> PointerToMutable<Self> {
let p: PointerToMutable<Self> = .allocate(count: 1)
Self.`init`(self: &p.unsafe[], f)
return p
}
}
public fun main() {
let gravity = 9.81
&gravity = 11.2 error: cannot assign, `gravity` is a `let` binding
}
  • DirectorySources
    • DirectoryHello
      • Hello.hylo
    • DirectoryGreetings
      • Greetings.hylo