Documentation
¶
Overview ¶
Package lib implements the standard library (section 11 and stdlib.md) as builtins, and builds the prelude table that binds every prelude name.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // HtmlElementTag is Html.Element: { name, attributes, children }. HtmlElementTag = value.NewTag("Html.Element", value.RecordTag, []string{"name", "attributes", "children"}) // HtmlAttributeTag is Html.Attribute: { name, value }. HtmlAttributeTag = value.NewTag("Html.Attribute", value.RecordTag, []string{"name", "value"}) // HtmlTextTag is Html.Text: { text }. HtmlTextTag = value.NewTag("Html.Text", value.RecordTag, []string{"text"}) // HtmlRawTag is Html.Raw: { markup }. HtmlRawTag = value.NewTag("Html.Raw", value.RecordTag, []string{"markup"}) )
var ( ReflectTypeTag = value.NewTag("Reflect.Type", value.SyncTag, nil) ReflectErasedTypeTag = value.NewTag("Reflect.ErasedType", value.SyncTag, nil) ReflectDeclTag = value.NewTag("Reflect.Decl", value.SyncTag, nil) ReflectValueTag = value.NewTag("Reflect.Value", value.SyncTag, nil) ShapeNullTag = value.NewTag("Reflect.Null", value.RecordTag, nil) ShapeVoidTag = value.NewTag("Reflect.Void", value.RecordTag, nil) ShapeNeverTag = value.NewTag("Reflect.Never", value.RecordTag, nil) ShapeBoolTag = value.NewTag("Reflect.Bool", value.RecordTag, nil) ShapeIntTag = value.NewTag("Reflect.Int", value.RecordTag, []string{"bits", "signed"}) ShapeFloatTag = value.NewTag("Reflect.Float", value.RecordTag, []string{"bits"}) ShapeStringTag = value.NewTag("Reflect.String", value.RecordTag, nil) ShapeArrayTag = value.NewTag("Reflect.Array", value.RecordTag, []string{"element"}) ShapeMapTag = value.NewTag("Reflect.Map", value.RecordTag, []string{"key", "value"}) ShapeSetTag = value.NewTag("Reflect.Set", value.RecordTag, []string{"member"}) ShapeRecordTag = value.NewTag("Reflect.Record", value.RecordTag, []string{"decl", "args", "fields"}) ShapeFieldTag = value.NewTag("Reflect.Field", value.RecordTag, []string{"name", "type", "hasDefault"}) ShapeTaggedTag = value.NewTag("Reflect.Tagged", value.RecordTag, []string{"decl", "args", "base"}) ShapeUnionTag = value.NewTag("Reflect.Union", value.RecordTag, []string{"members"}) ShapeFuncTag = value.NewTag("Reflect.Func", value.RecordTag, []string{"params", "result"}) ShapeOpaqueTag = value.NewTag("Reflect.Opaque", value.RecordTag, []string{"decl", "args"}) )
The Reflect namespace (section 11, Reflect): type values, shapes, and reflected values. The opaque types are tags that `is` cannot test, as the sync types are; the shapes are record tags whose values Reflect.shape builds. A type value is the checker's own types.Type, so equality, union membership, substitution, and assignability are the checker's code.
var CmdTag = value.NewTag("Cmd", value.RecordTag, []string{"program", "args", "dir", "env"})
CmdTag is Cmd: { program: string, args: Array[string], dir: string | null, env: Map[string, string] | null }, with the defaults the prelude declares.
CutTag is String.Cut: { before: string, after: string }.
var EntryTag = value.NewTag("File.Entry", value.RecordTag, []string{"name", "isDir", "isSymlink"})
EntryTag is File.Entry: { name: string, isDir: bool, isSymlink: bool }, an entry of a directory.
var FrameTag = value.NewTag("Panic.Frame", value.RecordTag, []string{"function", "path", "line", "column"})
FrameTag is Panic.Frame: { function: string, path: string, line: int, column: int }.
var InfoTag = value.NewTag("File.Info", value.RecordTag, []string{"name", "size", "isDir", "isSymlink", "modified", "mode", "uid", "gid"})
InfoTag is File.Info: { name: string, size: int, isDir: bool, isSymlink: bool, modified: Time.Instant, mode: int, uid: int | null, gid: int | null }.
var MatchTag = value.NewTag("Regex.Match", value.RecordTag, []string{"text", "start", "end", "groups", "named"})
MatchTag is Regex.Match: { text, start, end, groups, named }.
var OutputBytesTag = value.NewTag("Cmd.OutputBytes", value.RecordTag, []string{"status", "statuses", "stdout", "stderr"})
OutputBytesTag is Cmd.OutputBytes: { status: int, statuses: Array[int], stdout: Bytes, stderr: string }, standard output as the last stage wrote it and standard error as text.
var OutputTag = value.NewTag("Cmd.Output", value.RecordTag, []string{"status", "statuses", "stdout", "stderr"})
OutputTag is Cmd.Output: { status: int, statuses: Array[int], stdout: string, stderr: string }, both outputs as text.
PanicTag is Panic: { message: string, trace: Array[Panic.Frame] }.
var PartsTag = value.NewTag("Url.Parts", value.RecordTag, []string{"scheme", "opaque", "user", "host", "port", "path", "query", "fragment"})
PartsTag is Url.Parts: a reference as RFC 3986 divides it.
PipeTag is Os.Pipe: { read: File.Handle, write: File.Handle }.
PipelineTag is Cmd.Pipeline: { cmds: Array[Cmd] }.
var ReplyTag = value.NewTag("Http.Reply", value.RecordTag, []string{"status", "headers", "body"})
ReplyTag is Http.Reply: what a handler of Http.serve returns, with a body that is a string or Bytes.
var RequestTag = value.NewTag("Http.Request", value.RecordTag, []string{"method", "path", "query", "headers", "bytes", "remote"})
RequestTag is Http.Request: what a handler of Http.serve receives, the body held once, as received; Http.text decodes it.
var ResponseTag = value.NewTag("Http.Response", value.RecordTag, []string{"status", "headers", "bytes"})
ResponseTag is Http.Response: { status: int, headers: Map[string, string], bytes: Bytes }, the body held once, as received; Http.text decodes it.
Functions ¶
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is an open file, a standard stream, a connection, or a buffer over one: File.Handle. A reader holds the read slot, a writer the write mutex, and close takes the state mutex alone, so one goroutine may read a connection while another writes it, and a close from a third ends both. A write goes to the OS before it returns, except into the buffer of a buffered handle.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is a listening TCP socket: Net.Listener. Connections are accepted by a pump, one goroutine started at the first Net.accept, which hands each over conns to the next caller, so a caller selects on its own context and disturbs no other; a connection accepted while no caller waits is held for the next one.
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process is a started command, one child per stage: Cmd.Process. A goroutine waits for them from the start, so they are reaped whether or not the program waits, and records the outcome every Cmd.wait returns.
type Random ¶
type Random struct {
// contains filtered or unexported fields
}
Random is the seeded generator of section 11: xoshiro256** over four words, seeded by SplitMix64. Every value it gives is fixed by the spec, so no step here may change. Goroutines that share one race (section 9), so mu keeps the state whole: each operation, a whole shuffle included, is one step that a racing one comes before or after.
Source Files
¶
- args.go
- array.go
- bits.go
- bytes.go
- chan.go
- context.go
- crypto.go
- csv.go
- encoding.go
- file.go
- file_fs.go
- glob.go
- html.go
- http.go
- iter.go
- json.go
- json_other.go
- lib.go
- lock_flock.go
- map.go
- math.go
- net.go
- os.go
- owner_unix.go
- parallel.go
- path.go
- process.go
- process_unix.go
- pump.go
- random.go
- reflect.go
- regex.go
- result.go
- set.go
- string.go
- sync.go
- terminal.go
- test.go
- time.go
- tty_linux.go
- tty_unix.go
- url.go