Skip to Content

Under construction

This page is still being written; content and examples may change.

Import

import decides how external names enter the file: some bring a prefix, some bring short names, and some only activate extension methods. Each of the nine forms has its own job.

The Forms at a Glance

FormWhat you getTypical use
import Mod;prefix Mod (no short names injected)qualified access Mod.f()
import Pkg::Mod;cross-package module prefixqualified access across packages
import Mod as A;prefix renamed to Adisambiguation, shortening
import Mod.*;short names for all top-level symbols of the moduledirect short-name use
import Mod.{X, Y as Z};short names for selected symbols (per-symbol aliasing allowed)precise injection
import Mod.X;equivalent to Mod.{ X }precise injection
import Mod.X as Y;equivalent to Mod.{X as Y}precise injection
import Mod.extension;no names (activation only)extension methods only
import Pkg::*;every module name in the package as a prefixbulk cross-package

Prefixes, Wildcards, and Aliases

import Math.*; import Collections.*; func Bigger<T>(a: T, b: T) where T: Ordered -> T { if a < b { return b; } return a; } func main() -> int { print(Bigger(3, 9)); print(Math.Max(2, 5), Math.Abs(-4)); val s = new set<string>(); s.Add("a"); print(s.Contains("a")); return 0; }
9 5 4 True

编写到此Written up to here

本页其余部分尚未完成,内容随时补充。The rest of this page is not written yet; more content will follow.

Last updated on October 11, 2026