ghul.runtime
34.0.0
Prefix Reserved
dotnet add package ghul.runtime --version 34.0.0
NuGet\Install-Package ghul.runtime -Version 34.0.0
<PackageReference Include="ghul.runtime" Version="34.0.0" />
<PackageVersion Include="ghul.runtime" Version="34.0.0" />
<PackageReference Include="ghul.runtime" />
paket add ghul.runtime --version 34.0.0
#r "nuget: ghul.runtime, 34.0.0"
#:package ghul.runtime@34.0.0
#addin nuget:?package=ghul.runtime&version=34.0.0
#tool nuget:?package=ghul.runtime&version=34.0.0
ghūl compiler runtime library
This package provides:
- internal types required by all ghūl applications
- support for the ghūl pipe operator and fluent methods on pipes, such as
filter,mapandreduce slice, which takes part of an array, list or string:xs |> slice(1..4). An array or a list is sliced without copying, so a later change to the source shows through- function combinators, in
Ghul(reached withuse Ghul):f >> gcomposes left to right andf << gright to left, keeping the multi-argument stage's own arity -add >> tagcomposes a two-argumentaddwith a unarytagand calls it astagged(4, 5);curryanduncurryreshape a two-argument function in either direction;memo(f)answers from a cache of the resultsfhas already computed, keyed on the whole argument tuple;memo_rec(f)does the same for a recursive function, handingfthe memoised function to make its recursive calls through, so every level is cached -memo_rec((fib, n: int) => if n < 2 then bigint(n) else fib(n - 1) + fib(n - 2) fi); andapply(f, x, y)calls a function of any arity with the arguments of the call itself - number theory, in
Ghul.Numericsoverint,longandbigintalike:is_prime, aprimes()stream (andprimes(from), which overbiginthas no end),prime_factorsandfactorize,divisors,divisor_count,divisor_sum,totient,gcd,lcm,factorial,binomial,mod_pow,isqrt,is_squareanddigit_sum. Primality is exact forintandlong, and the Baillie-PSW test, which has no known counterexample, above that; results that don't fit the type throwSystem.OverflowException. The prime functions share one sieve, so they are not safe to call from more than one thread at a time retry(f, attempts)calls f, retrying the whole call up to the given number of times when it throws and throwing the last failure when every attempt does; the wrapped function keeps f's own arityGhul.Coroutines, cooperative coroutines: asynchronous functions returningCOROUTINE[T]orCOROUTINE, which one coroutine awaits as it would call a function.pause()gives up the turn,sleep(milliseconds)gives it up until a deadline,run()resumes parked coroutines one at a time,CHANNEL[T]hands values between them, andMUTEXandSEMAPHOREguard what they share. All of it runs on one thread, on a defaultSCHEDULERunless one is named. A coroutine can also await a task or any other awaitable:run()waits for it and resumes the coroutine on its own thread. Where that thread cannot block, such an await is reported as an error- MSBuild targets needed to build ghūl projects
Building a library or an executable
The targets follow the standard OutputType property:
Library(the .NET SDK's default when the project does not set one) builds a library. It needs noentry()function.ExeorWinExebuilds an executable, which needs anentry()function.
Other values are rejected. To choose directly, regardless of OutputType, set
GhulLibrary to true or false.
<PropertyGroup>
<OutputType>Library</OutputType>
</PropertyGroup>
Repository layout
This repository holds two source trees. ghul-runtime/ is the runtime library
itself, built on .NET as the ghul.runtime package by ghul-runtime.ghulproj.
ghul-core/ is the source core library, which supplies on the wasm and llvm
targets the types .NET supplies on the other; it is not compiled on .NET, and
was brought here from ghul-core, which
this repository supersedes. Each tree carries its own ghul-project.json, so a
ghul-cli project can depend on either by path, and the manifest at the
repository's root covers both trees' sources: the single ghul-runtime
library a version or tag dependency resolves carries the whole compilation
unit. The .NET package is unaffected - ghul-runtime.ghulproj globs only the
runtime tree's sources.
The WebAssembly target
Under --target wasm the runtime is compiled from source together with
ghul-core: both trees' src/**/*.ghul are compiled whole. A file whose
declarations belong to one target only carries @@IF.dotnet() or
@@IF.source_core() on its first line — the former compiles only into the
.NET assembly, the latter only on a target whose core library is compiled
from source, WebAssembly and LLVM. Within a file compiled everywhere,
@IF.dotnet() and @IF.source_core() mark the individual declarations that
belong to one target only. ghul-runtime/src's files that declare types
ghul-core also declares carry the file-level form. What is not yet
available on the wasm target is tracked on
ghul-lang/ghul#3319.
wasm-tests/ holds programs that build for the wasm target from this
checkout's sources and run under Node, each a ghul-cli project whose
run.expected is what the same program prints on .NET. Run them with
dotnet ghul-test wasm-tests, and the ones that also build as native
executables with dotnet ghul-test --config llvm wasm-tests. A test's manifest
lists the targets it passes on; the gaps that keep the rest off llvm are
tracked on ghul-lang/ghul#3460.
native-aot-tests/ renders values with $ under the JIT and published with
Native AOT, where rendering cannot rely on reflection, and checks that both
print its run.expected. See its README for how to run it.
Issues
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on ghul.runtime:
| Package | Downloads |
|---|---|
|
ghul.analysis.protocol
client library for the ghūl compiler's analysis-mode JSON protocol |
|
|
ghul.raster
Drawing into a PNG from ghūl: antialiased strokes and circles, an affine view, axes, colour maps and stroke-font text, in managed code with no native dependency |
|
|
ghul.repl
The session behind a ghūl read-eval-print loop: the accepted cells, the import prelude each new submission needs, and what a compiled cell exports. Compiles nothing and runs nothing itself, so a terminal, a browser page or a notebook kernel can host it. |
|
|
ghul.repl.host
Hosts a ghūl REPL session on this machine: compiles each cell with an installed ghul.compiler, kept running as a compile server with a fallback to starting it per cell, loads the result into a load context of the session's own, and runs it. |
|
|
ghul.project
Reads and checks a ghūl project manifest: the ghul-project.json that says what a project is called, where its sources are and what it depends on. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 34.0.0 | 0 | 10/28/2026 |
| 33.0.0 | 108 | 10/27/2026 |
| 32.0.0 | 372 | 10/27/2026 |
| 31.4.0 | 304 | 10/26/2026 |
| 31.3.0 | 222 | 10/26/2026 |
| 31.2.0 | 64 | 10/26/2026 |
| 31.1.0 | 85 | 10/25/2026 |
| 31.0.5 | 115 | 10/25/2026 |
| 31.0.4 | 91 | 10/25/2026 |
| 31.0.3 | 370 | 10/25/2026 |
| 31.0.2 | 93 | 10/25/2026 |
| 31.0.1 | 82 | 10/25/2026 |
| 31.0.0 | 159 | 10/24/2026 |
| 30.0.0 | 91 | 10/24/2026 |
| 29.4.0 | 94 | 10/24/2026 |
| 29.3.1 | 93 | 10/23/2026 |
| 29.3.0 | 557 | 10/23/2026 |
| 29.2.1 | 274 | 10/21/2026 |
| 29.2.0 | 813 | 10/20/2026 |
| 29.1.2 | 90 | 10/20/2026 |